如何将 Spring Roo 与 Apache Wicket 结合使用?

发布于 2024-12-28 12:18:15 字数 892 浏览 4 评论 0原文

我有一个由 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

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

I have a persistence layer (JPA entity objects) created and managed by Roo. It is in its own project, builds to a jar, and I have used it with a separate Spring MVC 3 web application.

I'd like to use this same Roo persistence project in another web application powered by Apache Wicket. I have seen a couple of the Roo add-ons made for Wicket, but none of them even compile (I'm not the only one to have the issue).

The problem I am encountering is that whenever I try to call one of my Roo entities from within a Wicket Page or component, I get the following exception:

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)

I have configured my application following the Spring+Wicket wiki here: https://cwiki.apache.org/WICKET/spring.html

Does anyone know the 1,2,3 steps to set up a Wicket application to utilize Spring Roo entities? Any help is appreciated. Thanks!

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

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

发布评论

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

评论(2

喜爱纠缠 2025-01-04 12:18:15

我在谷歌代码中找到了这个,听起来它完全按照你想要的方式http:// /code.google.com/p/spring-roo-wicket-addon/

I found this in google code, sounds like its doing exactly what you want http://code.google.com/p/spring-roo-wicket-addon/

り繁华旳梦境 2025-01-04 12:18:15

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

public class Start {

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

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

I found the solution to my problem. When I ran my wicket webapp using the Maven jetty:run goal, it worked. However, I was trying to start Jetty via Java code:

public class Start {

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

I was not loading the Spring ApplicationContext in this "Start" class. Once I modified this class to load the Spring application context, it worked

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