当前位置:网站首页>Steps of building SSM framework
Steps of building SSM framework
2022-07-07 12:49:00 【Six years of Surabaya】
SSM Steps of framework construction
1. Import Spring、SpringMVC、MyBatis Dependence
2. Import Spring、SpringMVC、MyBatis Configuration file for
3. stay Spring The following contents are configured in the configuration file of :
(1) Configure data sources
(2) To configure MyBatis The factory of conversation SqlSessionFactoryBean, And inject the data source
(3) To configure MyBatis Automatic scanning DAO layer Mapper Interface and configuration MyBatis Path to map file
(4) adopt component-scan Comment on service Scanning of layers
(5) Configure the propagation characteristics of transactions 、 Isolation level 、 Rollback strategy , Let those add、delete、update The first method starts the commit and rollback of transactions , Other methods are read-only transactions .
(6) Configure the transaction management aspect class , Crosscut service layer .
4. stay SpringMVC The following is configured in the configuration file :
(1) Use component-scan Tag open right controller Scanning of layers
(2) adopt annotation-driven Tags enable annotation driven
(3) Configure the view parser
(4) If you need to upload files , You also need to configure the file upload parser , And specify the size of file upload Limit
5. stay MyBatis The following contents are configured in the configuration file of :
(1) Configure printing on the console SQL sentence
(2) Configure enable L2 cache
(3) Configure underline to turn to small hump automatically
6. stay web.xml The following is configured in
(1) To configure Spring Listening in , And load Spring Configuration file for
(2) To configure SpringMVC Core controller of DispatcherServlet And load SpringMVC Configuration file for
(3) In order to prevent Chinese garbled , Generally, you will also configure an encoding filter and set the character encoding set to UTF-8
7. Actually, that's all , our SSM Even if the framework is built , Then you can develop the project .
Create a new control layer and add @Controller annotation , Then add @RequestMapping annotation , Next, in the control layer class, pass @Autowired or @Resource Annotation injection Service layer , stay Service Layers pass through @Autowired or @Resource Annotation injection DAO layer , What needs to be noted here is ,DAO Layer has only interfaces but no implementation classes , It's through MyBatis In the mapping file namespace Indicate the implemented DAO layer Mapper Interface , And pass MyBatis In the mapping file SQL Of ID Indicates the call DAO layer Mapper Interface method to be executed SQL sentence .
边栏推荐
猜你喜欢
[deep learning] image multi label classification task, Baidu paddleclas
Leetcode skimming: binary tree 25 (the nearest common ancestor of binary search tree)
opencv的四个函数
Day-16 set
leetcode刷题:二叉树20(二叉搜索树中的搜索)
Cookie
2022A特种设备相关管理(锅炉压力容器压力管道)模拟考试题库模拟考试平台操作
图像像素读写操作
Vxlan static centralized gateway
Common knowledge of one-dimensional array and two-dimensional array
随机推荐
Leetcode brush question: binary tree 24 (the nearest common ancestor of binary tree)
What is an esp/msr partition and how to create an esp/msr partition
[疑难杂症]pip运行突然出现ModuleNotFoundError: No module named ‘pip‘
sql-lab (54-65)
Simple implementation of call, bind and apply
[爬虫]使用selenium时,躲避脚本检测
基于NeRF的三维内容生成
Day-20 file operation, recursive copy, serialization
leetcode刷题:二叉树21(验证二叉搜索树)
静态Vxlan 配置
【PyTorch实战】图像描述——让神经网络看图讲故事
Static vxlan configuration
[crawler] avoid script detection when using selenium
Charles: four ways to modify the input parameters or return results of the interface
Sorting, dichotomy
广州市召开安全生产工作会议
Master公式。(用于计算递归的时间复杂度。)
普乐蛙小型5d电影设备|5d电影动感电影体验馆|VR景区影院设备
ps链接图层的使用方法和快捷键,ps图层链接怎么做的
2022广东省安全员A证第三批(主要负责人)考试练习题及模拟考试