当前位置:网站首页>Architecture analysis of three-tier project and parameter name injection of construction method
Architecture analysis of three-tier project and parameter name injection of construction method
2022-07-29 05:14:00 【It's a quack】
Catalog
Architecture analysis of three-tier project
Not Spring Take over the three-tier project construction :
spring Take over the creation of three-tier objects
Use the constructor parameter name to inject values
Use the parameter name of the construction method to inject values
Use the subscript of the construction method parameter to inject the value
Assign values using the default parameters of the constructor
Architecture analysis of three-tier project
Use three-tier architecture to insert users
Interface layer , Business logic layer , Data access layer ( simulation )
Spring Will take over the creation of which objects in the three-tier architecture ? Interface layer objects , Business logic layer objects , Data access layer objects .
Not Spring Take over the three-tier project construction :
Entity class
com.bjpowernode.pojo Users
Data access layer
com.bjpowernode.dao UsersMapper.java( Interface )
UsersMapperImpl.java( Implementation class )
Business logic layer
com.bjpowernode.service UsersService.java( Interface )
UsersServiceImpl.java( Implementation class )
Interface layer
com.bjpowernode.controller UsersController.java
Next, we will continue to build a framework 



Then create a new entity class


Inside the entity class set、get Methods should be added !(Alt+Insert)



spring Take over the creation of three-tier objects
Logical objects of the data access layer

Business logic layer 
Interface layer

The last step is to test
The three steps of the test should be clear ! A certain !
Use the constructor parameter name to inject values
Use the parameter name of the construction method to inject values
Student stu = new Student(" Zhang San ",22);
a. Use the parameter name of the construction method to inject values
<bean id="school" class="com.bjpowernode.pojo3.School">
<constructor-arg name="name1" value=" Tsinghua University "></constructor-arg>
<constructor-arg name="address1" value=" Haidian District "></constructor-arg>
</bean>
c. Inject values in the order of the parameters of the default construction method
<bean id="stuSequence" class="com.bjpowernode.pojo3.Student">
<constructor-arg value=" Chen Shi "></constructor-arg>
<constructor-arg value="22"></constructor-arg>
<constructor-arg ref="school"></constructor-arg>
</bean>

Then let's test
The name of the constructor is used as the injection value

Use the subscript of the construction method parameter to inject the value
b. Use the subscript injection value of the construction method parameter
<bean id="stu" class="com.bjpowernode.pojo3.Student">
<constructor-arg index="0" value=" Qian Qi "></constructor-arg>
<constructor-arg index="1" value="22"></constructor-arg>
<constructor-arg index="2" ref="school"></constructor-arg>
</bean>



Assign values using the default parameters of the constructor



边栏推荐
- Excel卡住了没保存怎么办?Excel还没保存但是卡住了的解决方法
- [sudden] solve remote: support for password authentication was removed on August 13, 2021. please use a perso
- Ros1 dead chicken data is stored in txt and SQLite
- The representation of time series analysis: is the era of learning coming?
- Soft link & hard link
- 玩家访问网站自动弹窗加QQ群方法以及详细代码
- MySQL regularly calls preset functions to complete data update
- [wechat applet -- solve the alignment problem of the last line of display:flex. (discontinuous arrangement will be divided into two sides)]
- Google gtest事件机制
- 浅谈AspectJ框架
猜你喜欢

玩家访问网站自动弹窗加QQ群方法以及详细代码

ARFoundation入门教程10-平面检测和放置

Use annotation test in idea

【2022新生学习】第三周要点

Learn the first program of database

学习数据库的第一个程序

Stack and queue and priority queue (large heap and small heap) simulation implementation and explanation of imitation function

Soft link & hard link

TCP三次握手四次挥手

Mapper agent development
随机推荐
Double type nullpointexception in Flink flow calculation
[untitled]
SQL log
Office提示系统配置无法运行怎么办?
如何让照片中的人物笑起来?HMS Core视频编辑服务一键微笑功能,让人物笑容更自然
怎样监测微型的网站服务
A little knowledge about management
Northeast University Data Science Foundation (matlab) - Notes
输入的查询SQL语句,是如何执行的?
ODOO开发教程之透视表
Mapper agent development
About realizing page Jump of website in Servlet
Use annotation test in idea
Create a mindscore environment in modelars, install mindvision, and conduct in-depth learning and training (Huawei)
Connection database time zone setting
Unity Metaverse(三)、Protobuf & Socket 实现多人在线
Deadlock to be resolved
About the configuration and use of thymeleaf
JDBC statement + resultset introduction
Wps如何使用智能填充快速填充数据?Wps快速填充数据的方法