简体   繁体   English

spring-roo如何生成骨架应用程序?

[英]How spring-roo generate skeleton application works?

I'm curious about how the spring-roo generated application works, I have some questions: 我很好奇spring-roo生成的应用程序是如何工作的,我有一些问题:

  1. Where is the servlets? servlet在哪里?
  2. Where is the code link the domain object to GUI? 代码在哪里将域对象链接到GUI?
  3. Where is the code instantiate the spring POJO? 代码在哪里实例化弹簧POJO?
  4. Where is data persistence code? 数据持久性代码在哪里?
  5. Why the domain class(bean) is not declared in spring configuration file? 为什么域类(bean)未在spring配置文件中声明?

Could anyone help me to understand the structure of the skeleton project? 谁能帮我理解骨架项目的结构? Thanks 谢谢

The architecture section of the spring roo reference documentation has info that would answer most of your questions. spring roo参考文档的架构部分提供了可以回答大部分问题的信息。 It will be easier to understand if you have some knowledge of spring, jpa and aop. 如果你对spring,jpa和aop有一些了解,那将更容易理解。

Here is my answer after some study, I'm not sure if it is correct. 经过一些研究,这是我的答案,我不确定它是否正确。 Any comment or correction is greatly appreciated. 任何评论或更正都非常感谢。

1.Where is the servlets? 1. servlet在哪里?

Roo generated project use spring mvc as presentation layer, Spring will search all class annotated with "@controller" as the controller class. Roo生成项目使用spring mvc作为表示层,Spring将搜索所有带有“@controller”注释的类作为控制器类。

2.Where is the code link the domain object to GUI? 2.代码将域对象链接到GUI?

Domain object are classes annotated with "@Entity", roo also add "@RooJpaActiveRecord" to indicate DAO functionality. 域对象是用“@Entity”注释的类,roo还添加“@RooJpaActiveRecord”来指示DAO功能。

3.Where is the code instantiate the spring POJO? 3.代码是否在实例化弹簧POJO?

All the domain object are instantiated through the database queries, which lives in *_Roo_Jpa_ActiveRecord.aj. 所有域对象都通过数据库查询进行实例化,数据库查询位于* _Roo_Jpa_ActiveRecord.aj中。

4.Where is data persistence code? 4.数据持久性代码是什么?

Answered in Q2. 在Q2回答。

5.Why the domain class(bean) is not declared in spring configuration file? 5.为什么域类(bean)没有在spring配置文件中声明?

Spring automatically detect domain object through annotation "@Entity" Spring通过注释“@Entity”自动检测域对象

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM