当前位置: 首页 > news >正文

ssm框架配置文件例子

emmm。。。。

就是说,正常ssm的配置文件长啥样?

就最基础的?

贴一下,备忘吧。

第一个:applicationContext.xml

<beans xmlns="http://www.springframework.org/schema/beans"xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p"xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsdhttp://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsdhttp://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd"><!-- 使用spring自带的占位符替换功能 --><beanclass="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"><!-- 允许JVM参数覆盖 --><property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" /><!-- 忽略没有找到的资源文件 --><property name="ignoreResourceNotFound" value="true" /><!-- 配置资源文件 --><property name="locations"><list><value>classpath:jdbc.properties</value></list></property></bean><context:component-scan base-package="cn.itcast"/><bean id="dataSource" class="com.jolbox.bonecp.BoneCPDataSource"destroy-method="close"><!-- 数据库驱动 --><property name="driverClass" value="${jdbc.driver}" /><!-- 相应驱动的jdbcUrl --><property name="jdbcUrl" value="${jdbc.url}" /><!-- 数据库的用户名 --><property name="username" value="${jdbc.username}" /><!-- 数据库的密码 --><property name="password" value="${jdbc.password}" /><!-- 检查数据库连接池中空闲连接的间隔时间,单位是分,默认值:240,如果要取消则设置为0 --><property name="idleConnectionTestPeriod" value="60" /><!-- 连接池中未使用的链接最大存活时间,单位是分,默认值:60,如果要永远存活设置为0 --><property name="idleMaxAge" value="30" /><!-- 每个分区最大的连接数 --><property name="maxConnectionsPerPartition" value="150" /><!-- 每个分区最小的连接数 --><property name="minConnectionsPerPartition" value="5" /></bean><!-- 定义Mybatis的SqlSessionFactory --><bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"><property name="dataSource" ref="dataSource" /><property name="configLocation" value="classpath:mybatis/mybatis-config.xml" /><!-- 扫描mappers目录以及子目录下的所有xml文件 --><property name="mapperLocations" value="classpath:mybatis/mappers/**/*.xml" /><property name="typeAliasesPackage" value="cn.itcast.mybatis.pojo"/></bean><!-- 定义Mapper -->
<!-- 	<bean id="orderMapper" class="org.mybatis.spring.mapper.MapperFactoryBean"><property name="mapperInterface" value="cn.itcast.mybatis.mapper.UserMapper" /><property name="sqlSessionFactory" ref="sqlSessionFactory" /></bean> --><bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"><property name="basePackage" value="cn.itcast.mybatis.mapper" /></bean></beans>

第二个:applicationContext-transaction.xml

<beans xmlns="http://www.springframework.org/schema/beans"xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p"xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsdhttp://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsdhttp://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd"><!-- 定义事务管理器 --><bean id="transactionManager"class="org.springframework.jdbc.datasource.DataSourceTransactionManager"><property name="dataSource" ref="dataSource" /></bean><!-- 定义事务策略 --><tx:advice id="txAdvice" transaction-manager="transactionManager"><tx:attributes><!--所有以query开头的方法都是只读的 --><tx:method name="query*" read-only="true" /><!--其他方法使用默认事务策略 --><tx:method name="*" /></tx:attributes></tx:advice><aop:config><!--pointcut元素定义一个切入点,execution中的第一个星号 用以匹配方法的返回类型,这里星号表明匹配所有返回类型。 com.abc.dao.*.*(..)表明匹配cn.itcast.mybatis.service包下的所有类的所有 方法 --><aop:pointcut id="myPointcut" expression="execution(* cn.itcast.mybatis.service.*.*(..))" /><!--将定义好的事务处理策略应用到上述的切入点 --><aop:advisor advice-ref="txAdvice" pointcut-ref="myPointcut" /></aop:config></beans>

第三个:mybatis-config.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configurationPUBLIC "-//mybatis.org//DTD Config 3.0//EN""http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration><settings><!-- 开启驼峰自动映射 --><setting name="mapUnderscoreToCamelCase" value="true" /></settings><plugins><plugin interceptor="com.github.pagehelper.PageHelper"><property name="dialect" value="mysql"/><!-- 该参数默认为false --><!-- 设置为true时,使用RowBounds分页会进行count查询 --><property name="rowBoundsWithCount" value="true"/></plugin></plugins>
</configuration>

第四个:web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns="http://java.sun.com/xml/ns/javaee"xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"id="MyWebApp" version="2.5"><display-name>itcast-springmvc-usermanage</display-name><context-param><param-name>contextConfigLocation</param-name><param-value>classpath:spring/applicationContext*.xml</param-value></context-param><!--Spring的ApplicationContext 载入 --><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener><!-- 编码过滤器,以UTF8编码 --><filter><filter-name>encodingFilter</filter-name><filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class><init-param><param-name>encoding</param-name><param-value>UTF8</param-value></init-param></filter><filter-mapping><filter-name>encodingFilter</filter-name><url-pattern>/*</url-pattern></filter-mapping><!-- 配置SpringMVC --><servlet><servlet-name>usermanage</servlet-name><servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class><load-on-startup>1</load-on-startup><init-param><param-name>contextConfigLocation</param-name><param-value>classpath:spring/usermanage-servlet.xml</param-value></init-param></servlet><servlet-mapping><servlet-name>usermanage</servlet-name><url-pattern>/</url-pattern></servlet-mapping><welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-list></web-app>

要找个简单的学习可以看一看哈。

相关文章:

ssm框架配置文件例子

emmm。。。。 就是说&#xff0c;正常ssm的配置文件长啥样&#xff1f; 就最基础的&#xff1f; 贴一下&#xff0c;备忘吧。 第一个&#xff1a;applicationContext.xml <beans xmlns"http://www.springframework.org/schema/beans"xmlns:context"http…...

maven构建项目报错:Failure to find com.microsoft.sqlserver:sqljdbc4:jar:4.0 in

背景 今天在项目里面查询sqlserver的数据库的时候&#xff0c;本地maven中引入依赖&#xff1a; <dependency><groupId>com.microsoft.sqlserver</groupId><artifactId>sqljdbc4</artifactId><version>4.0</version></dependenc…...

已解决rabbitmq AMQPConnectionClosedException:管道破裂或连接关闭异常的正确解决方法,亲测有效!!!

已解决rabbitmq AMQPConnectionClosedException&#xff1a;管道破裂或连接关闭异常的正确解决方法&#xff0c;亲测有效&#xff01;&#xff01;&#xff01; 目录 一、问题分析 二、报错原因 三、解决思路 四、解决方法 五、总结 博主v&#xff1a;XiaoMing_Java 一、…...

Excel 隔几行批量插入空白行

例如如下表格&#xff0c;每隔6行插入一行数据&#xff1a; 1&#xff09;第7个单元格输入1 2&#xff09;选中6个单元格&#xff0c;然后双击填充数据&#xff1a; 3&#xff09;F5 找到常量 Ctrlshift 复制插入的数据&#xff0c;然后选中数据 按F5&#xff0c;定位到空值...

2024年04月在线IDE流行度最新排名

点击查看最新在线IDE流行度最新排名&#xff08;每月更新&#xff09; 2024年04月在线IDE流行度最新排名 TOP 在线IDE排名是通过分析在线ide名称在谷歌上被搜索的频率而创建的 在线IDE被搜索的次数越多&#xff0c;人们就会认为它越受欢迎。原始数据来自谷歌Trends 如果您相…...

如何通过Elasticsearch实现搜索的关键词达到高亮的效果

高亮 首先介绍一下什么是搜索的关键词达到高亮的效果&#xff0c;如图所示 当在百度里面搜索elasticsearch的时候&#xff0c;可以看到出现的搜索结果里面elasticsearch这个关键词明显与其他的条文不一样&#xff0c;用红颜色凸显了“高亮效果”。当我们想要在自己的项目里面…...

真实sql注入以及小xss--BurpSuite联动sqlmap篇

前几天漏洞检测的时候无意发现一个sql注入 首先我先去网站的robots.txt去看了看无意间发现很多资产 而我意外发现admin就是后台 之后我通过基础的万能账号密码测试or ‘1‘’1也根本没有效果 而当我注入列的时候情况出现了 出现了报错&#xff0c;有报错必有注入点 因此我…...

Java类和对象练习题

练习一 下面代码的运行结果是&#xff08;&#xff09; public static void main(String[] args){String s;System.out.println("s"s);} 解析&#xff1a;本题中的代码不能编译通过&#xff0c;因为在Java当中局部变量必须先初始化&#xff0c;后使用。所以此处编译不…...

Qt 实现简易的视频播放器,功能选择视频,播放,暂停,前进,后退,进度条拖拉,视频时长显示

1.效果图 2.代码实现 2.1 .pro文件 QT core gui multimedia multimediawidgets 2.2 .h文件 #ifndef VIDEOPLAYING_H #define VIDEOPLAYING_H#include <QWidget> #include<QFileDialog>#include<QMediaPlayer> #include<QMediaRecorder> #in…...

vue基础教程(6)——构建项目级登录页

同学们可以私信我加入学习群&#xff01; 正文开始 前言一、创建首页二、登录页代码讲解三、对应的vue知识点&#xff1a;四、附件-各文件代码总结 前言 前面我们已经把vue自带的页面删除&#xff0c;也搭建了最简单的router路由&#xff0c;下面就可以真正开发我们自己的项目…...

C++宝强越狱1.0.6版本

没啥好说的&#xff0c;更新了一关&#xff0c;上代码 #include"bits/stdc.h" #include"Windows.h" #define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0) using namespace std; int w3,s3,a3,d3; bool nfalse,iptrue,mfals…...

构建高可用性数据库架构:深入探索Oracle Active Data Guard(ADG)

随着企业数据规模的不断增长和业务的复杂化&#xff0c;数据库的高可用性和可靠性变得尤为重要。Oracle Active Data Guard&#xff08;ADG&#xff09;作为Oracle数据库提供的一种高可用性解决方案&#xff0c;在实时备份和灾难恢复方面发挥着重要作用。本文将深入探讨ADG的原…...

记录-rosbag的处理

https://blog.csdn.net/qq_39607707/article/details/123716925 https://blog.csdn.net/weixin_51060040/article/details/126612496...

用Wireshark解码H.264

H264&#xff0c;你不知道的小技巧-腾讯云开发者社区-腾讯云 这篇文章写的非常好 这里仅做几点补充 init.lua内容&#xff1a; -- Set enable_lua to false to disable Lua support. enable_lua trueif not enable_lua thenreturn end-- If false and Wireshark was start…...

Flink中几个关键问题总结

硬核&#xff01;八张图搞懂 Flink 端到端精准一次处理语义 Exactly-once&#xff08;深入原理&#xff0c;建议收藏&#xff09; Flink可靠性的基石-checkpoint机制详细解析 硬核&#xff01;一文学完Flink流计算常用算子&#xff08;Flink算子大全&#xff09;...

华为配置ARP安全综合功能实验

华为配置ARP安全综合功能实验 组网图形 图1 配置ARP安全功能组网图 ARP安全简介配置注意事项组网需求配置思路操作步骤配置文件 ARP安全简介 ARP&#xff08;Address Resolution Protocol&#xff09;安全是针对ARP攻击的一种安全特性&#xff0c;它通过一系列对ARP表项学…...

new mars3d.layer.XyzLayer({的rectangle瓦片数据的矩形区域范围说明

new mars3d.layer.XyzLayer({的rectangle瓦片数据的矩形区域范围说明 2.这个xyz图层的矩形区域范围rectangle从图层文件中无法获取&#xff0c;但是看图层文件可以知道这个是12-21级的数据。 3.一般这个图层数据文件服务会有提供相应的rectangle范围&#xff0c;在服务的xml文…...

数据分析之Tebleau可视化:折线图、饼图、环形图

1.折线图的绘制 方法一&#xff1a; 拖入订单日期和销售金额&#xff0c;自动生成一个折线图 方法二&#xff1a; 选中订单日期和销售金额&#xff08;摁住ctrl可以选择多个纬度&#xff09; 点击右边的智能推荐&#xff0c;选择折线图 2.双线图的绘制、双轴的设置 方法一&…...

【Frida】【Android】 07_爬虫之网络通信库HttpURLConnection

&#x1f6eb; 系列文章导航 【Frida】【Android】01_手把手教你环境搭建 https://blog.csdn.net/kinghzking/article/details/136986950【Frida】【Android】02_JAVA层HOOK https://blog.csdn.net/kinghzking/article/details/137008446【Frida】【Android】03_RPC https://bl…...

算法2.6基数排序

基数排序 属于分配式排序,又称桶子法,通过键值的各个位上的值,将要排序的元素分配至某些桶中,达到排序的作用. 基数排序属于稳定性排序,是效率高的稳定性排序法 是桶排序的扩展,将整数按照位数进行切割,再按各个位数进行比较 是用空间换时间的经典算法 在使用8kw个数据进行…...

权限控制避坑指南:为什么你的RBAC系统总出问题?从数据库设计到接口鉴权全解析

RBAC权限系统深度避坑指南&#xff1a;从数据库设计到接口鉴权的全链路实践 在数字化系统开发中&#xff0c;权限控制就像建筑物的承重墙——平时看不见&#xff0c;一旦出问题就是系统性崩溃。我曾见过一个日活百万的电商平台因为角色权限配置错误&#xff0c;导致客服人员误删…...

Face3D.ai Pro效果展示:不同光照条件下正面人像的3D几何还原精度对比

Face3D.ai Pro效果展示&#xff1a;不同光照条件下正面人像的3D几何还原精度对比 1. 为什么光照条件对3D人脸重建如此关键 你有没有试过用手机拍一张自拍&#xff0c;结果发现鼻子一侧发亮、另一侧几乎全黑&#xff1f;或者在窗边拍照时&#xff0c;额头反光刺眼&#xff0c;…...

TrafficMonitor插件系统:5个技巧打造你的个性化Windows监控中心

TrafficMonitor插件系统&#xff1a;5个技巧打造你的个性化Windows监控中心 【免费下载链接】TrafficMonitorPlugins 用于TrafficMonitor的插件 项目地址: https://gitcode.com/gh_mirrors/tr/TrafficMonitorPlugins 想要让Windows任务栏上的TrafficMonitor变得更加强大…...

【方案、开源】从零到国一:空地协同消防无人机系统全栈技术解析

1. 空地协同消防无人机系统设计思路 第一次接触这个项目时&#xff0c;我和很多同学一样感到无从下手。直到把整个系统拆解成几个核心模块&#xff0c;思路才逐渐清晰。这个系统的关键在于"空地协同"四个字&#xff0c;简单说就是让无人机和小车像两个配合默契的消防…...

3种高效方案破解NCM格式限制:从单文件到批量处理的完整指南

3种高效方案破解NCM格式限制&#xff1a;从单文件到批量处理的完整指南 【免费下载链接】ncmdump 项目地址: https://gitcode.com/gh_mirrors/ncmd/ncmdump 你是否曾为网易云音乐的NCM加密格式而烦恼&#xff1f;当你想要在非网易生态设备上播放已购买音乐时&#xff0…...

Ryzen平台硬件调试终极指南:从问题诊断到系统优化的实战路径

Ryzen平台硬件调试终极指南&#xff1a;从问题诊断到系统优化的实战路径 【免费下载链接】SMUDebugTool A dedicated tool to help write/read various parameters of Ryzen-based systems, such as manual overclock, SMU, PCI, CPUID, MSR and Power Table. 项目地址: http…...

C++ STL 容器线程安全的边界条件

C STL容器线程安全的边界条件探析 在多线程编程中&#xff0c;C标准模板库&#xff08;STL&#xff09;容器的高效使用一直是开发者关注的焦点。尽管STL容器在设计上并未原生支持线程安全&#xff0c;但其性能优势使得开发者仍需在并发环境中谨慎使用。理解STL容器线程安全的边…...

3D Face HRN快速上手:无需代码,Gradio界面三步完成人脸重建

3D Face HRN快速上手&#xff1a;无需代码&#xff0c;Gradio界面三步完成人脸重建 1. 从一张照片到3D人脸&#xff0c;只需三步点击 你是否曾想过&#xff0c;将一张普通的自拍照或证件照&#xff0c;瞬间转化为一张可用于3D建模、游戏角色或虚拟形象的“皮肤地图”&#xf…...

多模态扩展:OpenClaw结合Qwen3.5-4B-Claude处理截图信息

多模态扩展&#xff1a;OpenClaw结合Qwen3.5-4B-Claude处理截图信息 1. 为什么需要多模态能力 作为一个长期依赖文本交互的技术爱好者&#xff0c;我最初对OpenClaw的理解停留在"能通过自然语言控制电脑的AI助手"层面。直到上个月需要处理大量产品截图中的文字信息…...

Alpamayo-R1-10B详细步骤:从supervisorctl服务管理到日志实时监控

Alpamayo-R1-10B详细步骤&#xff1a;从supervisorctl服务管理到日志实时监控 1. 引言&#xff1a;为什么你需要关注这个自动驾驶模型 如果你正在研究自动驾驶&#xff0c;或者对AI如何“看懂”路况并做出决策感到好奇&#xff0c;那么Alpamayo-R1-10B绝对值得你花时间了解。…...