(重要) 快速的搭建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:38 阅读更多 →
没有剪辑团队如何做 TikTok 带货视频?AI工具如何帮助电商团队提升效率

没有剪辑团队如何做 TikTok 带货视频?AI工具如何帮助电商团队提升效率

随着 TikTok Shop、抖音电商等短视频渠道的发展,越来越多商家开始意识到,商品销售已经不仅依赖传统图文展示,短视频内容正在成为影响用户决策的重要方式。但对于很多中小电商团队来说,一个现实问题是:没有专业剪辑人员…

2026/7/28 13:59:38 阅读更多 →
ComfyUI-WanVideoWrapper完全指南:5分钟掌握AI视频生成核心技术 [特殊字符]

ComfyUI-WanVideoWrapper完全指南:5分钟掌握AI视频生成核心技术 [特殊字符]

ComfyUI-WanVideoWrapper完全指南:5分钟掌握AI视频生成核心技术 🎬 【免费下载链接】ComfyUI-WanVideoWrapper 项目地址: https://gitcode.com/GitHub_Trending/co/ComfyUI-WanVideoWrapper 你是否想过将静态图像变成生动的视频?或者…

2026/7/28 13:59:38 阅读更多 →

最新新闻

风扇静音革命:用Fan Control为你的PC打造“隐形“散热管家

风扇静音革命:用Fan Control为你的PC打造“隐形“散热管家

风扇静音革命:用Fan Control为你的PC打造"隐形"散热管家 【免费下载链接】FanControl.Releases This is the release repository for Fan Control, a highly customizable fan controlling software for Windows. 项目地址: https://gitcode.com/GitHub…

2026/7/28 14:23:12 阅读更多 →
如何用Diablo Edit2存档修改器告别暗黑2重复刷怪,3分钟打造完美角色?

如何用Diablo Edit2存档修改器告别暗黑2重复刷怪,3分钟打造完美角色?

如何用Diablo Edit2存档修改器告别暗黑2重复刷怪,3分钟打造完美角色? 【免费下载链接】diablo_edit Diablo II Character editor. 项目地址: https://gitcode.com/gh_mirrors/di/diablo_edit 你是否厌倦了在暗黑破坏神2中花费数小时只为刷一件装备…

2026/7/28 14:23:12 阅读更多 →
成本CO

成本CO

物料成本构成 TCK07 成本构成结构 (用公司代码取elehk)TCKH3 成本构成结构和对应的列ckmlhd 成本估算号(物料工厂得到一个成本估算号)marc 取成本核算批量ckmlprkeph 标准成本 (成本估算号年度期间 得到一条数据&#…

2026/7/28 14:23:12 阅读更多 →
RF射频电路PCB布局布线核心技巧与实战经验

RF射频电路PCB布局布线核心技巧与实战经验

1. RF射频信号布局布线的重要性与挑战在电子设计领域,RF射频电路一直被视为"黑魔法"般的存在。作为一名经历过无数次改板的PCB工程师,我深刻理解射频设计中的每一个微小失误都可能导致整个项目推倒重来。与低频数字电路不同,射频信…

2026/7/28 14:23:12 阅读更多 →
AI编程助手横向评测:ChatGPT、Gemini与Claude在游戏复刻项目中的实战表现

AI编程助手横向评测:ChatGPT、Gemini与Claude在游戏复刻项目中的实战表现

作为一名游戏开发者,你是否曾想过,如果让当前最顶尖的AI编程助手来“复刻”一款经典游戏,它们各自的表现会如何?是ChatGPT的代码逻辑更严谨,Gemini的创意更贴合需求,还是Claude的工程化能力更强&#xff1f…

2026/7/28 14:23:12 阅读更多 →
快手视频批量下载神器:3分钟学会无水印保存技巧

快手视频批量下载神器:3分钟学会无水印保存技巧

快手视频批量下载神器:3分钟学会无水印保存技巧 【免费下载链接】KS-Downloader 快手(KuaiShou)作品视频/图片下载工具 项目地址: https://gitcode.com/gh_mirrors/ks/KS-Downloader 还在为无法保存喜欢的快手视频而烦恼吗&#xff1f…

2026/7/28 14:22:12 阅读更多 →

日新闻

告别臃肿!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:43 阅读更多 →
RAG必踩坑!财报法规检索不准?这款开源工具让答案浮出水面,准确率飙升98.7%!

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

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

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

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

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

2026/7/28 0:00:43 阅读更多 →

周新闻

深度学习道路桥梁裂缝检测系统 道路桥梁裂缝检测数据集 道路桥梁病害识别检测数据集

深度学习道路桥梁裂缝检测系统 道路桥梁裂缝检测数据集 道路桥梁病害识别检测数据集

深度学习道路桥梁裂缝检测系统 数据集6000张 完整源码已标注数据集训练好的模型环境配置教程程序运行说明文档,可以直接使用!系统支持图片、视频、摄像头等多种方式检测裂缝,功能强大实用。 1数据集6000张 8各类别

2026/7/28 12:04:22 阅读更多 →
深度学习YOLO模型如何训练 PUBG 绝地求生目标检测数据集

深度学习YOLO模型如何训练 PUBG 绝地求生目标检测数据集

pubg数据集 精选原图1.42万数据 1.49万标签 无任何重复、算法增强或冗余图像! pubg绝地求生目标检测数据集 1分类:e_body,14905个标签,txt格式 共计14244张图,99%为640*640尺寸图像 适合yolo目标检测、AI训练关键词&am…

2026/7/28 8:29:16 阅读更多 →
Apex英雄目标检测数据集 深度学习框架YOLO如何训练APEX数据集

Apex英雄目标检测数据集 深度学习框架YOLO如何训练APEX数据集

Apex检测数据集数据集详情检测类别: allies enemy tag图片总量:7247张训练集:5139张验证集:1425张测试集:683张标注状态:全部已标注,即拿即用数据格式:支持YOLO格式及其他格式&#…

2026/7/28 5:03:42 阅读更多 →

月新闻