【问题标题】:How to use Spring Roo with Apache Wicket?如何将 Spring Roo 与 Apache Wicket 一起使用?
【发布时间】:2012-01-22 20:44:43
【问题描述】:

我有一个由 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 步骤吗?任何帮助表示赞赏。谢谢!

【问题讨论】:

    标签: spring wicket spring-roo wicket-1.5


    【解决方案1】:

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

    【讨论】:

    • 这个项目没有编译
    【解决方案2】:

    我找到了解决问题的方法。当我使用 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 应用程序上下文,它就可以工作了

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-02-09
      • 1970-01-01
      • 1970-01-01
      • 2022-06-12
      • 2015-08-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多