(重要) 快速的搭建ssm框架(聚合工程)   主要就是5个配置文件
搭建的详细步骤见: https://blog.csdn.net/AdamCafe/article/details/91491025SSM聚合工程 项目结构如下:ssm_dao接口 实体类 接口映射文件 applicationContextion-dao.xml 配置文件 测试类代码如下:?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beans xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance xmlns:phttp://www.springframework.org/schema/p xmlns:contexthttp://www.springframework.org/schema/context xmlns:txhttp://www.springframework.org/schema/tx xmlns:mvchttp://www.springframework.org/schema/mvc xmlns:aophttp://www.springframework.org/schema/aop xsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd bean idsqlSessionFactory classorg.mybatis.spring.SqlSessionFactoryBean property namedataSource refdataSource/property /bean bean iddataSource classcom.alibaba.druid.pool.DruidDataSource property namedriverClassName valuecom.mysql.jdbc.Driver/property property nameurl valuejdbc:mysql:///springdb1/property property nameusername valueroot/property property namepassword valueroot/property /bean bean idmapperScannerConfigurer classorg.mybatis.spring.mapper.MapperScannerConfigurer property namebasePackage valuebank.dao/property /bean /beans代码如下:package User; import bank.dao.UserDao; import bank.domain.User; import org.apache.ibatis.io.Resources; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactoryBuilder; import org.junit.Test; import java.io.IOException; import java.io.InputStream; import java.util.List; public class testUserDao { Test public void testUserDao() throws IOException { InputStream is Resources.getResourceAsStream(sqlMapConfig.xml); SqlSessionFactoryBuilder builder new SqlSessionFactoryBuilder(); SqlSessionFactory factory builder.build(is); SqlSession session factory.openSession(); UserDao userDao session.getMapper(UserDao.class); ListUser list userDao.findAll(); for (User user : list) { System.out.println(user); } session.commit(); session.close(); } }ssm_service接口 接口实现类 applicationContext-service.xml配置文件 测试类?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beans xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance xmlns:phttp://www.springframework.org/schema/p xmlns:contexthttp://www.springframework.org/schema/context xmlns:txhttp://www.springframework.org/schema/tx xmlns:mvchttp://www.springframework.org/schema/mvc xmlns:aophttp://www.springframework.org/schema/aop xsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd !--包扫描-- context:component-scan base-packagebank.service/context:component-scan !-- 引入dao的配置文件 -- import resourceapplicationContext-dao.xml/import !--事物配置: xml配置-- !--1 创建事务管理器-- bean idtransactionManager classorg.springframework.jdbc.datasource.DataSourceTransactionManager property namedataSource refdataSource/property /bean !--2 事务通知-- tx:advice idtxAdvice tx:attributes tx:method namesave*/ tx:method nameupdate*/ tx:method namedelete*/ tx:method namefind* propagationSUPPORTS read-onlytrue/ tx:method name*/ /tx:attributes /tx:advice !--3 配置事物AOP-- aop:config aop:pointcut idpt expressionexecution(* bank.service.*.impl.*.*(..))/aop:pointcut aop:advisor advice-reftxAdvice pointcut-refpt/aop:advisor /aop:config /beans测试package test; import bank.domain.User; import bank.service.UserService; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.util.List; RunWith(SpringJUnit4ClassRunner.class) ContextConfiguration(locations classpath:applicationContext-service.xml) public class testUserService { Autowired private UserService userService; Test public void test(){ ListUser users userService.findAll(); for (User user : users) { System.out.println(user); } } }ssm_webcontroller springmvc.xml配置文件 web.xml配置文件?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beans xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance xmlns:phttp://www.springframework.org/schema/p xmlns:contexthttp://www.springframework.org/schema/context xmlns:txhttp://www.springframework.org/schema/tx xmlns:mvchttp://www.springframework.org/schema/mvc xmlns:aophttp://www.springframework.org/schema/aop xsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd !--包扫描-- context:component-scan base-packagebank.controller/context:component-scan !--1 视图解析器-- bean idviewResolver classorg.springframework.web.servlet.view.InternalResourceViewResolver property nameprefix value/WEB-INF/pages//property property namesuffix value.jsp/property /bean !--日期转换器-- !--bean idconversionService classorg.springframework.context.support.ConversionServiceFactoryBean property nameconverters list bean classweb.converter.StringToDateConverter/bean /list /property /bean-- !--注解驱动-- !--将日期转换器注册到mvc中-- mvc:annotation-driven /mvc:annotation-driven /beans?xml version1.0 encodingUTF-8? web-app xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance xmlnshttp://java.sun.com/xml/ns/javaee xsi:schemaLocationhttp://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd version2.5 !--监听器-- listener listener-classorg.springframework.web.context.ContextLoaderListener/listener-class /listener context-param param-namecontextConfigLocation/param-name param-valueclasspath:applicationContext-service.xml/param-value /context-param !--解决post乱码-- filter filter-namecharacterEncodingFilter/filter-name filter-classorg.springframework.web.filter.CharacterEncodingFilter/filter-class init-param param-nameencoding/param-name param-valueutf-8/param-value /init-param init-param param-nameforceEncoding/param-name param-valuetrue/param-value /init-param /filter filter-mapping filter-namecharacterEncodingFilter/filter-name url-pattern/*/url-pattern /filter-mapping servlet servlet-namespringmvc/servlet-name servlet-classorg.springframework.web.servlet.DispatcherServlet/servlet-class !--指定加载的配置文件,通过参数contextConfigLocation加载-- init-param param-namecontextConfigLocation/param-name param-valueclasspath:springmvc.xml/param-value /init-param !--指定加载顺序-- load-on-startup1/load-on-startup /servlet servlet-mapping servlet-namespringmvc/servlet-name url-pattern//url-pattern /servlet-mapping /web-app最后 部署tomcat进行测试

相关新闻

2026年性价比高的果蔬清洗机大揭秘!究竟哪家价格更优?

2026年性价比高的果蔬清洗机大揭秘!究竟哪家价格更优?

在当下,家庭在清洁与饮食健康领域面临诸多痛点,食品安全焦虑、手洗效率低下、传统清洁方式有隐患等问题困扰着大家。而蓝力鲸Blueceti作为集自主研发、设计、生产、销售于一体的健康家电品牌,为我们带来了优质的解决方案。下面就为大家详细介…

2026/7/28 14:00:46阅读更多 →
收藏 | 工业大模型入门指南:小白程序员必备,开启智能制造新篇章

收藏 | 工业大模型入门指南:小白程序员必备,开启智能制造新篇章

本文介绍了工业AI及工业大模型的概念、应用范畴和行业应用,详细阐述了工业大模型在研发、生产、管理、服务等方面的具体应用场景,包括需求预测、研发流程优化、设备管理、质量检测、智能生产管理、库存管理、物流配送等。同时,文章还探讨了工…

2026/7/28 14:00:46阅读更多 →
市面上国产替代的DDR内存颗粒测试治具工厂整套解决方案

市面上国产替代的DDR内存颗粒测试治具工厂整套解决方案

在半导体产业蓬勃发展的今天,DDR内存颗粒测试治具的需求与日俱增。然而,长期以来高端DDR内存颗粒测试治具市场被国外厂商垄断,国内工厂面临诸多痛点。不过,随着国产厂商的崛起,国产替代的DDR内存颗粒测试治具工厂整套解…

2026/7/28 13:58:46阅读更多 →
JAVA毕设项目:基于 SpringBoot 的大学生互助交流社区论坛平台设计 校园动态分享与交互式论坛管理系统 (源码+文档,讲解、调试运行,定制等)

JAVA毕设项目:基于 SpringBoot 的大学生互助交流社区论坛平台设计 校园动态分享与交互式论坛管理系统 (源码+文档,讲解、调试运行,定制等)

博主介绍:✌️码农一枚 ,专注于大学生项目实战开发、讲解和毕业🚢文撰写修改等。全栈领域优质创作者,博客之星、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java、小程序技术领域和毕业项目实战 ✌️技术范围:&am…

2026/7/28 16:31:50阅读更多 →
qt5core.dll 找不到怎么办:Qt 软件目录与隔离记录的排查

qt5core.dll 找不到怎么办:Qt 软件目录与隔离记录的排查

电脑做过清理、装过安全软件,或者刚把某个目录删掉之后,再打开软件弹出“由于找不到 qt5core.dll,无法继续执行代码”,这种就要怀疑文件被隔离、误删,或者原本依赖的目录被清理工具动过。一、qt5core.dll 更像软件目录…

2026/7/28 16:31:50阅读更多 →
Java项目打包成EXE全攻略

Java项目打包成EXE全攻略

Java项目打包成EXE全攻略 引言在Java开发中,我们经常需要将项目打包成可执行的EXE文件,方便用户在没有安装Java运行环境(JRE)的Windows系统上直接运行。本文将从实战角度出发,详细介绍几种主流方法,包括使用…

2026/7/28 16:31:50阅读更多 →
AI降重工具深度测评:技术原理与实战对比

AI降重工具深度测评:技术原理与实战对比

1. 项目概述:AI降重工具的深度测评需求最近在内容创作圈子里,AI生成内容(AIGC)的检测和降重需求突然暴增。作为每天要处理大量文字工作的内容从业者,我深刻感受到这个痛点的迫切性——无论是学术论文查重、自媒体内容原…

2026/7/28 16:31:50阅读更多 →
基础Demo_5switch语句 判断(学习笔记)

基础Demo_5switch语句 判断(学习笔记)

switch语句 和上篇if同为判断语句 关键字为:case defauit break seitch格式一public class Demo01_SWITCH{public static void main(String[] args){// 定义变量,表示月份 int month 8; // 使用switch ,根据月份,输出季节 switch(month){case 1:System.out.printl…

2026/7/28 16:31:50阅读更多 →
【Springboot毕设全套源码+文档】基于SpringBoot的智慧物业管理系统的设计与实现(丰富项目+远程调试+讲解+定制)

【Springboot毕设全套源码+文档】基于SpringBoot的智慧物业管理系统的设计与实现(丰富项目+远程调试+讲解+定制)

博主介绍:✌️码农一枚 ,专注于大学生项目实战开发、讲解和毕业🚢文撰写修改等。全栈领域优质创作者,博客之星、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java、小程序技术领域和毕业项目实战 ✌️技术范围:&am…

2026/7/28 16:29:50阅读更多 →
覆盖国产 + 海外 + 开源模型,OpenClaw 2.7.9 Windows/Mac 双端部署详解

覆盖国产 + 海外 + 开源模型,OpenClaw 2.7.9 Windows/Mac 双端部署详解

🔹 工具基础介绍 OpenClaw 是开源生态中一款实用性较强的本地智能工具,凭借本地离线运行、可视化图形操作和任务自动化三大核心特性,赢得了众多用户的青睐。与普通在线对话AI工具不同,它属于能够直接操控本机软硬件的智能数字员工…

2026/7/28 4:06:39阅读更多 →
伺服阀焊完微漏毁整机?精密激光焊接三关锁住高压

伺服阀焊完微漏毁整机?精密激光焊接三关锁住高压

所谓液压伺服阀体的精密激光焊接,是用激光束对阀座壳体(通常为不锈钢或铝合金)进行密封焊接,使阀体在21-35MPa的高压液压油或压缩气体中长期运行而不发生介质泄漏。液压伺服阀是高端液压系统的"大脑"。从航空航天飞行控…

2026/7/28 2:08:06阅读更多 →
D2DX:三步实现《暗黑破坏神2》高清宽屏体验的终极指南

D2DX:三步实现《暗黑破坏神2》高清宽屏体验的终极指南

D2DX:三步实现《暗黑破坏神2》高清宽屏体验的终极指南 【免费下载链接】d2dx D2DX is a complete solution to make Diablo II run well on modern PCs, with high fps and better resolutions. 项目地址: https://gitcode.com/gh_mirrors/d2/d2dx 你是否还在…

2026/7/28 1:38:28阅读更多 →
告别臃肿!3步让你的暗影精灵笔记本重获新生

告别臃肿!3步让你的暗影精灵笔记本重获新生

告别臃肿!3步让你的暗影精灵笔记本重获新生 【免费下载链接】OmenSuperHub Control Omen laptop performance, fan speeds, and keyboard lighting, and unlock power limits. 项目地址: https://gitcode.com/gh_mirrors/om/OmenSuperHub 你是否也曾为官方Om…

2026/7/28 0:00:29阅读更多 →
RAG必踩坑!财报法规检索不准?这款开源工具让答案浮出水面,准确率飙升98.7%!

RAG必踩坑!财报法规检索不准?这款开源工具让答案浮出水面,准确率飙升98.7%!

做 RAG 的人应该都踩过这个致命的坑:把几百页的财报、法规、技术手册扔给向量库,问一个具体问题,搜出来的全是沾边但没用的内容 —— 关键信息要么被硬切块拆碎了,要么藏在几十条结果的最下面。语义相似≠真正相关,这个…

2026/7/28 0:00:29阅读更多 →
抖音视频文案提取工具全指南:免费2026版、手机App、在线工具一网打尽

抖音视频文案提取工具全指南:免费2026版、手机App、在线工具一网打尽

2026年做短视频运营,从抖音上扒文案早就不是偷偷抄笔记的事了。我刚开始做内容的时候,每天刷半小时抖音,手动把爆款视频的口播敲进备忘录,一条2分钟的视频得花十来分钟,碰到语速快的还要反复回听。后来试了一圈工具&am…

2026/7/28 0:00:29阅读更多 →
YOLOv8推理性能优化:从1.2FPS到35FPS的全链路加速实践

YOLOv8推理性能优化:从1.2FPS到35FPS的全链路加速实践

如果你在部署 YOLOv8 时,发现推理速度只有可怜的 1-2 FPS,而别人的演示视频却能跑到 30 FPS 以上,那么问题很可能不在模型本身,而在于你的整个处理链路。很多开发者拿到一个训练好的 YOLOv8 模型后,会直接使用官方示例…

2026/7/27 16:57:54阅读更多 →
Coze与Dify对比指南:低代码AI应用开发从入门到实战

Coze与Dify对比指南:低代码AI应用开发从入门到实战

1. 从零到一:为什么你需要了解 Coze 和 Dify?如果你对 AI 应用开发感兴趣,但一看到“大模型”、“智能体”、“工作流”这些词就头疼,觉得门槛太高,那这篇文章就是为你准备的。很多开发者,包括我自己&#…

2026/7/28 3:17:03阅读更多 →
AI生图工具怎么选?2026年6月版实测对比

AI生图工具怎么选?2026年6月版实测对比

做自媒体的朋友应该都有体会:配图一直是个让人头疼的问题。2026年,AI生图工具已经非常成熟了,但工具太多反而不知道怎么选。以下是截至2026年6月我对主流AI生图工具的实测对比。Midjourney V8.1:速度之王2026年6月11日&#xff0c…

2026/7/28 2:35:58阅读更多 →