Spring Roo Docs(3)Architecture and Multi Projects

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

你可能感兴趣的:(Architecture)