use*_*078 14 java spring domain-driven-design jpa maven
我正在尝试使用Spring/JPA配置和Maven多模块项目.这是总体布局.我有一个带有5个子模块的根模块.
backoffice (root maven module) | -(maven module)-----core (this is where persistence.xml and entityManager stuff resides). | -(maven module)-----employee (employee related entities, controllers, etc.) | -(maven module)-----vendor (vendor related entities, controllers, etc.) | -(maven module)-----customer (customer related entities, controllers, etc.) | -(maven module)-----web (contains all the web stuff).
我在core/src/main/resources/META-INF(persistence.xml,spring-context w/EntityManagerFactory,dataSource等)中拥有所有jpa内容.我的想法是希望在所有子模块(员工,供应商和客户)之间共享持久性内容.
问题是,当Web应用程序启动时,它找不到EntityMangerFactory.如果我在每个子模块(员工,供应商和客户)中设置JPA东西,那么它可以工作.
如何在核心中设置所有与持久性相关的东西,然后在其他模块中共享它?
提前致谢.
好吧,这是我最终使用的解决方案,以防有人感兴趣。
http://labs.bsb.com/2010/11/configuring-modular-jpa-applications-with-spring/
一些响应者问我为什么要首先以这种方式设置项目。原因是模块化。我希望一切都在小型的可测试和可部署的单元中。最终我们会将 OSGI 融入其中,以便客户可以选择他们想要安装的模块。每个模块必须具有独立运行的能力。
| 归档时间: |
|
| 查看次数: |
4383 次 |
| 最近记录: |