Spring Roo Docs(3)Architecture and Multi Projects

本文深入探讨了使用 Spring Roo 构建应用的架构设计,包括数据库后端、Java Persistence API (JPA)、持久化策略、Spring 框架依赖注入、事务管理等关键组件。同时介绍了如何利用 Maven 进行项目构建,以及在前端使用 Spring MVC 的经验分享。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Spring Roo Docs(3)Architecture and Multi Projects

Chapter 3. Application Architecture
3.1. Architectural Overview
database backend, Java Persistence API(JPA), persistence approach, Spring Framework dependency injection
transactional management, JUnit tests, a Maven build configuration, Spring MVC-based front-end

Some tips:
1. Roo can easily set up JMS message producers, consumers and SMTP
2. Writing a services layer annotated with Spring's @Service stereotype annotation
Exposing it using a remoting protocol to a rich client(Spring's remoting services)
3. Executing a series of predefined actions against the database with Spring's @Scheduled or @Async timer annotations

Layers
1. entity layer (similar to a domain layer)
2. web layer

3.2 Critical Technologies
AspectJ and Spring
3.2.1AspectJ
Roo projects use AspectJ's powerful inter-type declaration(ITD) features. Our .java files do not need to do anything unnatural like reference the generated ITD file and the whole process.

All the file in *_Roo_*.aj is an AspectJ ITD.
3.2.2 Spring

3.3. Entity Layer
Once I update the model in Base.java, that is an entity object in project pizza. Roo system will update the related Base.java
Base_Roo_JavaBean.aj
Base_Roo_Jpa_Entity.aj
Base_Roo_Jpa_ActiveRecord.aj
Base_Roo_ToString.aj

And if we need this function, we need to open the spring roo command shell window.

3.4. Web Layer
3.5. Optional Services Layer
3.6. Goodbye DAOs
3.7. Maven
3.7.1. Packaging
3.7.2. Multi-Module Support
find the example named multimodule.roo.
>mkdir petclinic
>cd petclinic
>roo
roo>script --file multimodule.roo
roo>quit
>mvn clean install
>cd ui/mvc
>mvn tomcat:run

verify this URL http://localhost:8080/mvc

I only studied module and enum in this project.
module
roo>project --topLevelPackage com.springsource.petclinic --packaging POM
roo>module create --moduleName core --topLevelPackage com.example.petclinic
roo>module focus --moduleName ~
roo>module create --moduleName ui --topLevelPackage com.example.petclinic.ui --packaging POM
roo>module create --moduleName mvc --topLevelPackage com.example.petclinic.ui.mvc

The project structure will be as follow:
petclinic
---->core
---->ui
---->mvc

enum
roo>enum type --class ~.reference.PetType
roo>enum constant --name Dog
roo>enum constant --name Cat
roo>enum constant --name Bird


references:

books:
spring-roo-docs.pdf
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值