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>

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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/785094.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

软考 - 系统架构设计师 - 敏捷开发方法

前言 敏捷开发方法是一种以人为核心、迭代、循序渐进的软件开发方法。它强调团队合作、客户需求和适应变化&#xff0c;旨在通过快速迭代和反馈来快速交付高质量的软件产品。 敏捷开发方法的优势在于能够快速响应变化、提高开发效率和质量、增强团队协作和沟通&#xff0c;并降…

Python程序设计 多重循环

教学案例六 多重循环 1.n之内的素数 输入n&#xff0c;显示n之内的所有素数 每行显示10个素数 例如&#xff0c;若输入500&#xff0c;结果如图所示 neval(input()) #代码开始 c 0for i in range(2, n1):for j in range(2, i):if i % j 0:breakelse:c 1print("{:5d}…

四年旅程,一路成长——小雨的创作纪念日

四年旅程&#xff0c;一路成长——小雨的创作纪念日 收到来信&#xff0c;回顾与再开始回首起点&#xff0c;初探技术世界持续前行&#xff0c;从坚持到自信今日之感&#xff0c;持续分享与感恩【3.19故事对话】我一定可以&#xff01;“新”认知状态变化感受复盘 朝着未来&…

Kubernetes(K8s)技术解析

1. K8s简介 Kubernetes&#xff08;简称K8s&#xff09;是一个开源的容器编排平台&#xff0c;旨在简化容器化应用程序的部署、扩展和管理。为开发者和运维人员提供了丰富的功能和灵活的解决方案&#xff0c;帮助他们更轻松地构建、部署和管理云原生应用程序。以下是关于Kubern…

C# OpenCvSharp-HoughCircles(霍夫圆检测) 简单计数

目录 效果 项目 代码 下载 效果 项目 代码 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using OpenCvSharp; using O…

http模块 服务器端如何响应(获取)静态资源?

一、静态资源与动态资源介绍&#xff1a; &#xff08;1&#xff09;静态资源 内容长时间不改变的资源。eg&#xff1a;图片、视频、css js html文件、字体文件... &#xff08;2&#xff09;动态资源 内容经常更新的资源。eg&#xff1a;百度首页、淘宝搜索列表... 二、服…

vue3从精通到入门7:ref系列

Vue 3 的 Ref 是一个集合&#xff0c;包括多个与响应式引用相关的功能&#xff0c;这些功能共同构成了 Vue 3 响应式系统的重要组成部分。以下是更全面的介绍&#xff1a; 1.ref ref 接受一个内部值并返回一个响应式且可变的 ref 对象。这个对象具有一个 .value 属性&#xf…

每天学习一个Linux命令之uniq

每天学习一个Linux命令之uniq 介绍 在Linux操作系统中&#xff0c;有许多强大的命令可以帮助我们提高工作效率。本篇博客将详细介绍一个非常有用的命令&#xff1a;uniq。uniq命令用于从已排序的文件或标准输入中删除重复的行&#xff0c;并将结果输出到标准输出中。 命令格…

【小熊猫 ide】更新支持mingw 支持c++20

没有format 头文件 GCC版本对C++的支持情况即使我使用11,也没有format 头文件小熊猫 ide https://wwe.lanzoui.com/b01os0mwd最新11可以自己更新https://royqh1979.gitee.io/redpandacpp/docsy/docs/gcc13 才支持format [7GCC 13 has added support for std::format.](https:/…

算法刷题笔记(3.25-3.29)

算法刷题笔记 3.25-3.29 1. 相同的树2. 二叉树的最近公共祖先3. 二叉搜索树中第K小的元素通过双端队列duque 中序遍历 4. 二叉树的锯齿形层序遍历new LinkedList<Integer>(levelList)双端队列复制 数组需要左右顺序&#xff0c;考虑双端队列 5. 岛屿数量6. 字典序排数&am…

Device Change-Procedure

Start Conditions: • The Service Provider has provided to the SM-DP the relevant information and configuration for the Device Change (see Annex O). • The End User has an old Device containing a Profile. • The eUICC and the LPAd of the old Device support …

python---基础(一)

文章目录 前言1.对象的基本组成2.变量和常量2.1.变量的声明2.2.常量_链式赋值_系列解包赋值2.2.1.常量是不是真的常量&#xff1f;2.2.2.链式赋值2.2.3.系列解包赋值 3.内置数据类型_基本算数运算符3.1四种内置数据类型3.2.基本运算符3.3.divmod() 前言 这几年&#xff0c;随着…

【Python】——变量名的命名规则

&#x1f383;个人专栏&#xff1a; &#x1f42c; 算法设计与分析&#xff1a;算法设计与分析_IT闫的博客-CSDN博客 &#x1f433;Java基础&#xff1a;Java基础_IT闫的博客-CSDN博客 &#x1f40b;c语言&#xff1a;c语言_IT闫的博客-CSDN博客 &#x1f41f;MySQL&#xff1a…

【C脚本】计算PCM的DBFS(分贝全尺度)

DBFS是分贝全尺度&#xff08;Decibels Full Scale&#xff09;的缩写&#xff0c;是一种用于衡量音频信号强度的单位。DBFS是相对于数字音频的最大可能幅度而言的&#xff0c;它的取值范围通常是从0到-∞。在DBFS中&#xff0c;0表示音频信号的最大幅度&#xff0c;-∞表示完全…

Dijkstra堆优化之蓝桥王国

Dijkstra堆优化 Dijkstra算法是一种用于解决单源最短路径问题的算法&#xff0c;即从图中的一个顶点出发到所有其他顶点的最短路径。然而&#xff0c;处理大图时&#xff0c;常规的Dijkstra算法可能会遇到性能问题。这就是Dijkstra的堆优化算法派上用场的地方。在堆优化版本中…

Python 用pygame简简单单实现一个打砖块

# -*- coding: utf-8 -*- # # # Copyright (C) 2024 , Inc. All Rights Reserved # # # Time : 2024/3/30 14:34 # Author : 赫凯 # Email : hekaiiii163.com # File : ballgame.py # Software: PyCharm import math import randomimport pygame import sys#…

(23)3.31 进阶指针

int main() { //指针数组 int* arr[4]; char* ch[5]; //数组指针 int arr2[5]; int(*pa)[5] &arr2; char* arr3[6]; char* (*p3)[6] &arr3; return 0; } int test(const char* str) { return 0; } int main() { …

OpenHarmony实战开发-如何使用rating组件实现星级打分功能。

介绍 本篇Codelab将引导开发者使用rating组件实现星级打分功能。 相关概念 rating组件&#xff1a;评分条&#xff0c;可根据用户判断进行打分。 环境搭建 软件要求 DevEco Studio版本&#xff1a;DevEco Studio 3.1 Release及以上版本。OpenHarmony SDK版本&#xff1a;A…

linux 一些命令

文章目录 linux 一些命令fdisk 磁盘分区parted 分区文件系统mkfs 格式化文件系统fsck 修复文件系统 mount 挂载swap 交换分区清除linux缓存df du 命令raid 命令基本原理硬raid 和 软raid案例raid 10 故障修复&#xff0c;重启与卸载 lvm逻辑卷技术LVM的使用方式LVM 常见名词解析…

Python爬虫详解:原理、常用库与实战案例

前言 前些天发现了一个巨牛的人工智能学习网站&#xff0c;通俗易懂&#xff0c;风趣幽默&#xff0c;忍不住分享一下给大家&#xff1a;https://www.captainbed.cn/z ChatGPT体验地址 文章目录 前言引言&#xff1a;一、爬虫原理1. HTTP请求与响应过程2. 常用爬虫技术 二、P…