pom.xml:

<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.study</groupId><artifactId>SSMBase_01</artifactId><version>1.0-SNAPSHOT</version><packaging>war</packaging><name>SSMBase_01 Maven Webapp</name><!-- FIXME change it to the project's website --><url>http://www.example.com</url><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><maven.compiler.source>1.8</maven.compiler.source><maven.compiler.target>1.8</maven.compiler.target><spring.version>5.0.10.RELEASE</spring.version><jackson.version>2.10.1</jackson.version></properties><dependencies><dependency><groupId>org.springframework</groupId><artifactId>spring-core</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-tx</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jdbc</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc</artifactId><version>${spring.version}</version></dependency><dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-databind</artifactId><version>${jackson.version}</version></dependency><dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-annotations</artifactId><version>${jackson.version}</version></dependency><dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-core</artifactId><version>${jackson.version}</version></dependency><dependency><groupId>javax.annotation</groupId><artifactId>javax.annotation-api</artifactId><version>1.3.1</version></dependency><dependency><groupId>javax.servlet.jsp</groupId><artifactId>jsp-api</artifactId><version>2.2.1-b03</version></dependency><dependency><groupId>javax.servlet</groupId><artifactId>servlet-api</artifactId><version>3.0-alpha-1</version></dependency><dependency><groupId>org.mybatis</groupId><artifactId>mybatis</artifactId><version>3.5.3</version></dependency><dependency><groupId>org.mybatis</groupId><artifactId>mybatis-spring</artifactId><version>2.0.3</version></dependency><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>8.0.18</version></dependency><dependency><groupId>c3p0</groupId><artifactId>c3p0</artifactId><version>0.9.1</version></dependency><dependency><groupId>commons-fileupload</groupId><artifactId>commons-fileupload</artifactId><version>1.4</version></dependency><dependency><groupId>commons-io</groupId><artifactId>commons-io</artifactId><version>2.6</version></dependency><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.13-rc-2</version></dependency><dependency><groupId>log4j</groupId><artifactId>log4j</artifactId><version>1.2.17</version></dependency></dependencies><build><finalName>SSMBase_01</finalName><pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --><plugins><plugin><artifactId>maven-clean-plugin</artifactId><version>3.1.0</version></plugin><!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging --><plugin><artifactId>maven-resources-plugin</artifactId><version>3.0.2</version></plugin><plugin><artifactId>maven-compiler-plugin</artifactId><version>3.8.0</version></plugin><plugin><artifactId>maven-surefire-plugin</artifactId><version>2.22.1</version></plugin><plugin><artifactId>maven-war-plugin</artifactId><version>3.2.2</version></plugin><plugin><artifactId>maven-install-plugin</artifactId><version>2.5.2</version></plugin><plugin><artifactId>maven-deploy-plugin</artifactId><version>2.8.2</version></plugin></plugins></pluginManagement></build>
</project>

web.xml:

<!DOCTYPE web-app PUBLIC"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN""http://java.sun.com/dtd/web-app_2_3.dtd" ><web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"version="4.0"><display-name>Archetype Created Web Application</display-name><!--配置首页--><welcome-file-list><welcome-file>/html/regist.html</welcome-file></welcome-file-list><!--配置Spring.xml监听器--><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener><context-param><param-name>contextConfigLocation</param-name><param-value>classpath:spring.xml</param-value></context-param><!--配置SpringMvc.xml前端控制器--><servlet><servlet-name>dispatcherServlet</servlet-name><servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class><init-param><param-name>contextConfigLocation</param-name><param-value>classpath:springmvc.xml</param-value></init-param></servlet><servlet-mapping><servlet-name>dispatcherServlet</servlet-name><url-pattern>/</url-pattern></servlet-mapping><!--配置字符过滤器--><filter><filter-name>characterEncodingFilter</filter-name><filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class><init-param><param-name>encoding</param-name><param-value>UTF-8</param-value></init-param></filter><filter-mapping><filter-name>characterEncodingFilter</filter-name><url-pattern>/*</url-pattern></filter-mapping></web-app>

spring.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:aop="http://www.springframework.org/schema/aop"xmlns:tx="http://www.springframework.org/schema/tx"xmlns:context="http://www.springframework.org/schema/context"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop.xsdhttp://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx.xsd"><!--配置-扫描Spring注解作用的包--><context:component-scan base-package="com.study"><!--不扫描@Controller--><context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/></context:component-scan><!--配置-扫描Properties文件资源--><context:property-placeholder location="db.properties"></context:property-placeholder><!--配置mybatis-1.DataSource(数据源)--><bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"><property name="driverClass" value="${jdbc.driver}"></property><property name="jdbcUrl" value="${jdbc.url}"></property><property name="user" value="${jdbc.username}"></property><property name="password" value="${jdbc.password}"></property></bean><!--配置mybatis-2.SqlSession(工厂)--><bean id="sqlSessionFactoryBean" class="org.mybatis.spring.SqlSessionFactoryBean"><property name="dataSource" ref="dataSource"></property></bean><!--配置mybatis-3.MapperDao(Dao接口映射)--><bean id="mapperScannerConfigurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer"><property name="basePackage" value="com.study.dao"></property></bean><!--1.配置【事务管理器】2.配置【事务通知】3.配置【AOP中的通用切入点表达式】4.建立【AOP的通用切入点表达式和事务通知】和【事务通知】的关系5.配置【事务属性】--><!--配置事务管理器--><bean id="dataSourceTransactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"><property name="dataSource" ref="dataSource"></property></bean><tx:advice id="txAdvice"><!--5.配置【事务属性】isolation:指定事务的隔离级别,默认;defaultpropagation:指定事务的传播行为,默认:REQUIRED(增删改)  标识一定会有事务,SUPPORTS(查询)read-only:指定事务是否只读,默认:falsetimeout:指定事务的超时时间,默认:-1 永不超时 秒为单位rollback-for:指定一个异常时,如果发生,该异常回滚,其他异常不回滚 默认:任何异常都回滚no-rollback-for:指定一个异常时,如果发生,该异常不回滚,其他异常回滚 默认:任何异常都回滚--><tx:attributes><tx:method name="*" propagation="REQUIRED" read-only="false"/><tx:method name="get*" propagation="SUPPORTS" read-only="true"/></tx:attributes></tx:advice><!--配置AOP增强--><aop:config><aop:pointcut id="txPointCut" expression="execution(* com.study.serviceimp.*.*(..))"/><aop:advisor pointcut-ref="txPointCut" advice-ref="txAdvice"></aop:advisor></aop:config></beans>

springmvc.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:mvc="http://www.springframework.org/schema/mvc"xmlns:context="http://www.springframework.org/schema/context"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/mvchttp://www.springframework.org/schema/mvc/spring-mvc.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context.xsd"><!--配置-扫描SpringMvc注解作用的包--><context:component-scan base-package="com.study"><!--只扫描@Controller--><context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/></context:component-scan><!--配置-视图解析器 --><bean id="internalResourceViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"><property name="prefix" value="/WEB-INF/pages/"></property><property name="suffix" value=".jsp"></property></bean><!--配置-自定义参数转换器--><bean id="conversionServiceFactoryBean" class="org.springframework.context.support.ConversionServiceFactoryBean"><property name="converters"><set><bean id="stringToDateUtil" class="com.study.util.StringToDateUtil"></bean></set></property></bean><!--配置-上传文件配置--><bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"><property name="maxUploadSize" value="104857600"></property></bean><!--配置-拦截器--><!--配置-开放静态资源前端控制器--><mvc:resources mapping="/css/**" location="/css/"></mvc:resources><mvc:resources mapping="/html/**" location="/html/"></mvc:resources><mvc:resources mapping="/img/**" location="/img/"></mvc:resources><mvc:resources mapping="/js/**" location="/js/"></mvc:resources><!--配置-SpringMvc对注解的支持--><mvc:annotation-driven conversion-service="conversionServiceFactoryBean"></mvc:annotation-driven></beans>

db.properties

jdbc.driver=com.mysql.cj.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/testdb?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8
jdbc.username=root
jdbc.password=admin123

SSM框架项目的pom导入包和xml配置相关推荐

  1. SSM框架笔记06:初探Spring——采用XML配置方式

    初探Spring--采用XML配置方式   Spring框架是一个轻量级的企业级开发的一站式解决方案.所谓解决方案就是可以基于Spring解决Java EE开发的所有问题.Spring框架主要提供了I ...

  2. maven项目的pom文件中各标签理解

    本文来说下maven项目的pom文件中各标签理解 文章目录 常用标签 常用标签 POM是项目对象模型(Project Object Model)的简称 pom.xml主要描述了项目的maven坐标,该 ...

  3. 梳理项目的pom文件

    [前言] Maven是一款十分棒的项目管理工具:毫无疑问pom文件是Maven项目中的命脉,管理着各个jar包之间相互依赖关系: 最近将项目中的pom文件重新梳理了一遍,发现pom文件如果乱了,后续会 ...

  4. Spring框架学习(四):聊一聊xml配置和Java配置

    之前的例子在演示过程中直接使用了xml的配置方式,对于刚刚接触Spring的同学来说肯定也是蒙圈的.这篇我们就从配置开始聊起. 在开发过程中,程序员通常使用这两种方式进行Spring的配置: 基于XM ...

  5. SSM整合时Maven项目的pom.xml版本兼容的代码备份

    场景 jdk:1.8 Tomcat:7.0 本地mysql:8.0 Eclipse:Eclipse Jee Photon Spring:4.3.8 AOP:1.8.0 mybatis:3.3.0 My ...

  6. maven项目的pom文件中常用的简单的标签理解

    maven的pom文件一些标签的理解 在本篇文章中,我只是将pom文件中的一些常用的并且比较简单的标签理解标记注释了.还有很多并常用但是也很重要的这里并没有列出.因为本人水平也有限的,所以请谅解. & ...

  7. maven项目的pom.xml 标签的含义

    下面是我新建一个maven项目后生产的pom.xml <?xml version="1.0" encoding="UTF-8"?> <proj ...

  8. SpringBoot项目的 pom.xml第一行报错

    当我们第一次创建SpringBoot项目的时候有时会发现SpringBoot项目里的pom.xml第一行报错. 对于这个报错问题,是由于jar包版本太高了. 错误显示 我们要修改jar包的版本 解决方 ...

  9. maven项目的pom.xml文件添加依赖

    先把添加依赖的代码放到pom.xml文件里,不出意外会爆红,其实是因为你的maven-repository仓库里没有对应的jar包. 我用的是intellij idea 2022.3的版本,爆红时右上 ...

最新文章

  1. Oracle中序列(Sequence)详解
  2. linux docker中gdb调试断点不停
  3. Java医疗管理系统技术描述
  4. IDEA编译的JAR包运行出现“没有主清单属性”
  5. Log4j 日志详细用法
  6. SiameseRPN++分析
  7. 数据结构顺序表基本流程
  8. MySQL:进阶应用
  9. 红外倒车雷达原理图_斯坦福研究登Nature子刊:芯片实现激光雷达技术,价格低至数百美元...
  10. 学习 Shell —— 括号、引号
  11. Emscripten 单词_分享15个英语单词记忆方法,简单实用,赶紧收藏吧!
  12. 怎么配置php发送邮件环境,如何配置PHP发送电子邮件?
  13. 抽象工厂模式(Abstract Factory Pattern)
  14. 计算机硬盘显示ntfs,电脑硬盘显示NTFS
  15. 阿里云数据库怎么使用
  16. 《缠中说禅108课》108:何谓底部?从月线看中期走势演化
  17. Flutter Dio的简易封装和demo
  18. Vmware安装MacOS系统
  19. Linux FQ 队列实现原理浅析
  20. 网申之后宣讲会有必要去吗?

热门文章

  1. 爬虫python入门_python爬虫入门教程有哪些?适合的只有这三个
  2. centos7 如何安装部署k8s_架构运维篇(五):Centos7/Linux中安装部署RocketMQ
  3. free mybatis 不生效_这些Mybatis-Plus的使用小技巧,你应该知道的!
  4. pycharm 右键无法显示unittest框架解决右键只有unittest 运行如何取消右键显示进行普通run...
  5. IntelliJ IDEA实时模板变量
  6. java ArrayList源码分析(转载)
  7. 一种较方便的MATLAB GUI中popupmenu中选取值得获得方法
  8. Access 中数据库操作时提示from子句语法错误
  9. [转载]:C# 中结构与类的区别
  10. 计算机网络学习笔记(3. 计算机网络结构)