1

我有一个由 Roo 创建和管理的持久层(JPA 实体对象)。它在自己的项目中,构建到一个 jar 中,我已经将它与一个单独的 Spring MVC 3 Web 应用程序一起使用。

我想在另一个由 Apache Wicket 提供支持的 Web 应用程序中使用相同的 Roo 持久性项目。我已经看到了一些为 Wicket 制作的 Roo 附加组件,但它们都没有编译(我不是唯一一个遇到问题的人)。

我遇到的问题是,每当我尝试从 Wicket 页面或组件中调用我的 Roo 实体之一时,都会出现以下异常:

Caused by: java.lang.IllegalStateException: Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)
at com.x.domain.UserAccount_Roo_Entity.ajc$interMethod$com_x_domain_UserAccount_Roo_Entity$com_x_domain_UserAccount$entityManager(UserAccount_Roo_Entity.aj:91)
at com.x.domain.UserAccount.entityManager(UserAccount.java:1)

我在这里按照 Spring+Wicket wiki 配置了我的应用程序:https ://cwiki.apache.org/WICKET/spring.html

有谁知道设置 Wicket 应用程序以利用 Spring Roo 实体的 1、2、3 个步骤?任何帮助表示赞赏。谢谢!

4

2 回答 2

0

我在谷歌代码中找到了这个,听起来就像你想要的那样http://code.google.com/p/spring-roo-wicket-addon/

于 2012-01-25T10:27:27.450 回答
0

我找到了解决我的问题的方法。当我使用 Maven jetty:run 目标运行我的 wicket webapp 时,它起作用了。但是,我试图通过 Java 代码启动 Jetty:

public class Start {

public static void main(String[] args) throws Exception {
    Server server = new Server();
    SocketConnector connector = new SocketConnector();
    server.start();
    }
}

我没有在这个“开始”类中加载 Spring ApplicationContext。一旦我修改了这个类来加载 Spring 应用程序上下文,它就可以工作了

于 2012-01-25T16:21:41.693 回答