笔记搭建ssm环境配置

使用maven快速构建ssm环境

1.pom依赖包引入




org.springframework
spring-webmvc
5.1.5.RELEASE



org.springframework
spring-jdbc
5.1.5.RELEASE



org.springframework
spring-aspects
5.1.5.RELEASE

2.web.xml配置





contextConfigLocation
classpath:spring-*.xml


org.springframework.web.context.ContextLoaderListener



charactorEncoding
org.springframework.web.filter.CharacterEncodingFilter

encoding
UTF-8



charactorEncoding
/*



springmvc
org.springframework.web.servlet.DispatcherServlet

contextConfigLocation
classpath:springmvc.xml

1


springmvc
/*


3.配置springmvc.xml


xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" >xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/mvc >http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://www.springframework.org/schema/beans >http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context >http://www.springframework.org/schema/context/spring-context->4.3.xsd">


    






class="org.springframework.http.converter.StringHttpMessageConverter>">


text/html;charset=UTF-8






class="org.springframework.web.servlet.view.InternalResourceViewRes>olver">





4.spring-service.xml配置




>

5.spring-mybatis.xml配置

xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx" >xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans >http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/context >http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/aop >http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
http://www.springframework.org/schema/tx >http://www.springframework.org/schema/tx/spring-tx-4.3.xsd">

location="classpath:mysql.properties"/>

class="com.alibaba.druid.pool.DruidDataSource">
>







class="org.mybatis.spring.SqlSessionFactoryBean">

value="classpath:mapper/*.xml">




class="org.mybatis.spring.mapper.MapperScannerConfigurer">


value="sessionFactory">








6.mysql.properties配置

jdbc.url=jdbc:mysql://localhost:3306/demo?>useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B>8&useSSL=false
jdbc.username=root
jdbc.password=root

7.UserMapper.xml配置





作者:吕小凯
链接:https://www.jianshu.com/p/3abb5e438139
來源:
著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

你可能感兴趣的:(笔记搭建ssm环境配置)