How to use the company framework to generate code to build a project
This is the back-end small class of the monastery. Each article is shared from
[background introduction] [knowledge analysis] [common problems] [solutions] [coding practice] [extended thinking] [more discussion] [References]
Eight aspects of in-depth analysis of back-end knowledge / skills. This article shares:
[how to use the company framework to generate code to build a project]
Hello, I'm the 11th java student of Zhengzhou branch of it Academy. I'm an honest and kind java programmer. Today, I'd like to share with you how to use the company framework to generate code and build a project
1. Background introduction
From task 1 to task 9, we are all handwritten codes and configuration files, and many of these codes or configuration files are repeated. In fact, in this process, everyone will think more or less. Are we doing too much repetitive work?
When the company develops a project, all entity classes, Dao layer and service layer are written manually, so the development efficiency of the project is relatively low.
2. Knowledge analysis
1) Framework core introduction
Distributed Tuscany, separation of web and service.
The registry, scallop, is a registry, and the service name corresponds to the corresponding service
2) Module division after code generation
Core: model, service interface, scaclient
Service: server, service implementation class, configuration file (spring, Tuscany server, dao.xml, database configuration file)
Web: controller, util, configuration file (spring, spring MVC, Tuscany client, scallop registry, cache...), JSP page, web xml
3) Points needing attention in building new projects
Maven private server configuration: it mainly configures the company's private server
Modify the hosts file: resolve the domain name provided by the registry
3. Frequently asked questions
1) Pay attention to the table, table name and service port
2) Scallop registry use
4. Coding practice
5. Expand thinking
Principle of registry
Registry: save the names of all services, the IP list of service providers and the IP list of service consumers
Service provider: provides cross process services
Service consumer: find the named service and consume it.
6. References
https://blog.csdn.net/ZhanLiJueDuan/article/details/82534176
7. More discussion
Q: To what extent does the company framework need to be learned?
A: Can run, can know how to modify SQL statements, basically enough
Q: Not in scallop resource. Can the service correspondence written in the center be used normally?
A: Theoretically, it is possible. Just like in task 9, when the registry is not applicable, Tuscany can still complete the separation of web and service.
Q: Is code generation common?
A: Very common. Reverse engineering of mybatis is a typical example. Company code generation is a. There should also be some open source projects on GitHub
This is the end of sharing
Ppt link video link