Xdoclet @spring.bean 未正确生成配置文件

发布于 2024-10-30 22:49:56 字数 1747 浏览 2 评论 0原文

我目前被困在使用 Spring 2.0.8(仍在等待升级签核),因为我无法使用注释,尽管我会使用 xdoclet 为我将要写入的大量 bean 生成 bean 配置文件未来。

但是,当我运行 ant 目标时,它会创建 xml 文件,但不包含任何 bean 标签。

我的 ant 脚本如下所示:

<taskdef name="springdoclet" classname="xdoclet.modules.spring.SpringDocletTask">
    <classpath refid="springdoclet.classpath"/>
</taskdef>

<taskdef name="doclet" classname="xdoclet.DocletTask">
    <classpath refid="springdoclet.classpath"/>
</taskdef>

<target name="generate-spring-wiring">
    <springdoclet destdir="${resource.dir}" excludedtags="@version,@author,@todo">
        <fileset dir="${global.src.dir}"/>
        <springxml destinationfile="spring-wiring.xml"/>
    </springdoclet>

</target>

生成的 xml 文件如下所示:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE beans PUBLIC
"-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">

<beans
default-autowire="no"
default-lazy-init="false"
default-dependency-check="none"
>

<!--
 To include additional bean definitions for Spring in the generated
 application context file, add a file to your XDoclet merge directory
  called spring-beans.xml that contains the <bean></bean> markup.
-->

</beans>

如您所见,尚未设置任何 beans。

我的 bean 类都继承自位于同一源目录中的父类。 MasterBean 已设置如下:

/**
 *
 *@spring.bean id="master"
 */
 abstract public class Master implements Rule {

 ..
 ..
 }

示例子类(在同一个包中设置如下:

/**
*
* @spring.bean id="G27"
*/
public class Global27_IncorrectFormTypeForCA extends Master {

这与我的类扩展超类这一事实有关吗?或者我只是设置不正确。这方面的文档几乎不存在,因此我们将不胜感激,

谢谢。

I'm stuck using Spring 2.0.8 at the moment (still awaiting sign-off on the upgrade) as I cannot use annotations I though I would use xdoclet to generate the beans config file for a large number of beans I will be writing in the future.

However, when I run my ant target it creates the xml file but it does not contain any bean tags.

My ant script looks like this:

<taskdef name="springdoclet" classname="xdoclet.modules.spring.SpringDocletTask">
    <classpath refid="springdoclet.classpath"/>
</taskdef>

<taskdef name="doclet" classname="xdoclet.DocletTask">
    <classpath refid="springdoclet.classpath"/>
</taskdef>

<target name="generate-spring-wiring">
    <springdoclet destdir="${resource.dir}" excludedtags="@version,@author,@todo">
        <fileset dir="${global.src.dir}"/>
        <springxml destinationfile="spring-wiring.xml"/>
    </springdoclet>

</target>

The resulting xml file looks like this:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE beans PUBLIC
"-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">

<beans
default-autowire="no"
default-lazy-init="false"
default-dependency-check="none"
>

<!--
 To include additional bean definitions for Spring in the generated
 application context file, add a file to your XDoclet merge directory
  called spring-beans.xml that contains the <bean></bean> markup.
-->

</beans>

As you can see no beans have been set up.

My bean classes all inherit from a parent class which is in the same source directory. The MasterBean has been set up as follows:

/**
 *
 *@spring.bean id="master"
 */
 abstract public class Master implements Rule {

 ..
 ..
 }

And a sample child class (in the same package is set up as follows:

/**
*
* @spring.bean id="G27"
*/
public class Global27_IncorrectFormTypeForCA extends Master {

Is this something to do with the fact that my classes extend a superclass? Or am I simply setting it up incorrectly. The documentation on this is virtually non-existent so any help would be gratefully recieved.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

合久必婚 2024-11-06 22:49:56

我在使用 XDoclet 和文件集子任务时遇到了一些问题,如果我将 dir 属性设置为 deep (如 src/java/my/pacakge/some/package),它将不起作用,将其设置为 < code>src/java 工作正常。

我知道 XDoclet 可以从具有超类的类生成 Spring bean。我项目的所有 bean 都扩展了其他一些类,但它们的超类不是 bean 本身,即没有 @spring.bean 并且它们都是正确生成的。我不确定这是否是一个问题,但由于您的 Master 类是抽象的,是否需要将其定义为 Spring bean? Spring确实有 的概念抽象bean,但它与抽象Java类不同。

I had some problems with XDoclet and the fileset subtask, if I set the dir attribute to deep (like src/java/my/pacakge/some/package) it wouldn't work, setting it to src/java worked fine.

I know XDoclet can generate Spring beans from classes with a superclass. All my project's beans extend some other class, but their superclass is not bean itself, i.e. no @spring.bean and they are all generated correctly. I am not sure if that's a problem, but since your Master class is abstract, does it need to be defined as a Spring bean? Spring does have the concept of an abstract bean, but it is not same as an abstract Java class.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文