文档章节

ssm框架整合

architect刘源源
 architect刘源源
发布于 2018/01/14 22:34
字数 2956
阅读 34
收藏 0

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.xsd
   http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
   http://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.xsd
   http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd">

   <!--导入外部配置文件  -->
   <!-- <context:property-placeholder location="classpath:/db-oracle.properties"/> -->
   
   <context:property-placeholder location="classpath:/db-mysql.properties"/>
   
   <!-- 扫描包 -->
   <context:component-scan base-package="cn.tarena.ht.service" />

   <!-- 数据源 -->
   <bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource">
      <property name="driverClassName" value="${jdbc.driver}"/>
      <property name="jdbcUrl" value="${jdbc.url}"/>
      <property name="username" value="${jdbc.username}"/>
      <property name="password" value="${jdbc.password}"/>
   </bean>

</beans>

springmvc-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
   xmlns:context="http://www.springframework.org/schema/context"
   xmlns:mvc="http://www.springframework.org/schema/mvc"
   xsi:schemaLocation="http://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-4.0.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

   <!-- MVC注解驱动 -->
   <mvc:annotation-driven/>

   <!-- 配置扫描器,使得@Controller注解生效 -->
   <context:component-scan base-package="cn.tarena.ht.controller" />

   <!-- 定义视图解析器 -->
   <!-- prefix="/WEB-INF/jsp/", suffix=".jsp", viewname="test" -> "/WEB-INF/jsp/test.jsp" -->
   <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
      <!-- 前缀 -->
      <property name="prefix" value="/WEB-INF/pages/" />
      <!-- 后缀 -->
      <property name="suffix" value=".jsp" />
   </bean>

   <!-- 处理静态资源被“/”所拦截的问题 -->
   <mvc:default-servlet-handler />
</beans>

db-mysql.properties

jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/ht?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
jdbc.username=root
jdbc.password=root

db-oracle.properties

jdbc.driver=oracle.jdbc.driver.OracleDriver
jdbc.url=jdbc:oracle:thin:@127.0.0.1:1521:XE
jdbc.username=ht1703
jdbc.password=ht1703

log4j.properties

log4j.rootLogger=DEBUG,A1
log4j.logger.org.mybatis = info
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss,SSS} [%t] [%c]-[%p] %m%n

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="jt-manage" version="2.5">
   <display-name>ht</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>
   
   <filter>
   <!--过滤器的名称 必须与bean标签中的ID一致  -->
   <filter-name>shiroFilter</filter-name>
   <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
      <init-param>
         <!--将Spring容器中的filter对象交给Web容器管理,web容器管理该Filter的生命周期  -->
         <param-name>targetFilterLifecycle</param-name>
         <param-value>true</param-value>
      </init-param>
    </filter>
  
  <filter-mapping>
   <filter-name>shiroFilter</filter-name>
   <url-pattern>/*</url-pattern>
  </filter-mapping>

   
   <!-- 配置SpringMVC -->
   <servlet>
      <servlet-name>springmvc</servlet-name>
      <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
      <!-- 指定SpringMVC配置文件 -->
      <init-param>
         <param-name>contextConfigLocation</param-name>
         <param-value>classpath:spring/springmvc-config.xml</param-value>
      </init-param>
      <load-on-startup>1</load-on-startup>
   </servlet>

   <servlet-mapping>
      <servlet-name>springmvc</servlet-name>
      <url-pattern>/</url-pattern>
   </servlet-mapping>
   
   <welcome-file-list>
      <welcome-file>index.jsp</welcome-file>
   </welcome-file-list>

</web-app>

mybatis-config.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
  PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
  "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>

   <settings>
      <!-- 开启驼峰自动映射 -->
      <setting name="mapUnderscoreToCamelCase" value="true" />
      <!-- 二级缓存的总开关 -->
      <setting name="cacheEnabled" value="false" />
   </settings>

   <plugins>
      <!-- 分页插件:com.github.pagehelper为PageHelper类所在包名 -->
      <plugin interceptor="com.github.pagehelper.PageHelper">
         <!-- 方言 -->
         <property name="dialect" value="oracle" />
         <!-- 该参数默认为false -->
         <!-- 设置为true时,使用RowBounds分页会进行count查询,查询数据总条数 -->
         <property name="rowBoundsWithCount" value="true" />
      </plugin>
      
      <!-- 通用Mapper插件 -->
      <!-- <plugin interceptor="com.github.abel533.mapperhelper.MapperInterceptor">
         主键自增回写方法,默认值MYSQL,详细说明请看文档
         property name="IDENTITY" value="MYSQL" /
         通用Mapper接口,多个通用接口用逗号隔开
         <property name="mappers" value="cn.tarena.ht.mapper.base.SysMapper" />
      </plugin> -->
      
      
   </plugins>
</configuration>

DeptMapper.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
  PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.tarena.ht.mapper.DeptMapper">
   
   <!--查询部门的全部信息  -->
   <select id="findAll" resultMap="deptRM">
      SELECT * FROM
       dept_p d
              LEFT JOIN
      (SELECT dept_id p_id,dept_name p_NAME FROM dept_p)p
              ON d.parent_id = p.p_id
       ORDER BY dept_id
   </select>
   
   <resultMap type="Dept" id="deptRM" autoMapping="true">
      <id column="dept_id" property="deptId"/>
      <!--其他属性驼峰规则自动完成映射  -->
      
      <!--自关联  一对一-->
      <association property="parentDept" javaType="Dept">
         <id column="p_id" property="deptId"/>
         <result column="p_name" property="deptName"/>
      </association>
   </resultMap>
   
   
   <!--状态的修改    接口文件传递的是一个array-->
   <update id="updateState">
      update dept_p set state = #{state} where dept_id in(
         <!--map中的Key  -->
         <foreach collection="deptIds" item="deptId" separator=",">
            #{deptId}
         </foreach>
      )
   </update>
   
   
   <!--删除部门信息  -->
   <delete id="deleteDepts">
      delete from dept_p where dept_id in(
         <foreach collection="array" item="deptId" separator=",">
            #{deptId}
         </foreach>
      )
   </delete>
   
   <insert id="saveDept">
      insert into dept_p(dept_id,parent_id,dept_name,state,create_time)
      values(
         #{deptId},
         #{parentDept.deptId},
         #{deptName},
         #{state},
         #{createTime}
      )
   </insert>
   
   <select id="findOne" resultMap="deptRM">
      select * from
     dept_p d
            left join
    (select dept_id p_id,dept_name p_name from dept_p)p
            on d.parent_id = p.p_id
   where dept_id = #{deptId}
   </select>
   
   
   <update id="updateDept">
      update dept_p set
      parent_id = #{parentDept.deptId},
      dept_name = #{deptName},
      state = #{state},
      update_time = #{updateTime}
      
      where dept_id =  #{deptId}
   </update>
   
   
   
   
   
</mapper>

DeptMapper

package cn.tarena.ht.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import cn.tarena.ht.pojo.Dept;

public interface DeptMapper {
   //查询全部部门信息
   public List<Dept> findAll();
   
   //将参数封装为一个Map
   public void updateState(@Param("deptIds") String[] deptIds, @Param("state") int state);
   
   //根据deptId 删除部门信息
   public void deleteDepts(String[] deptIds);
   
   //部门的新增
   public void saveDept(Dept dept);
   
   //根据Id查询数据
   public Dept findOne(String deptId);
   
   //修改部门信息
   public void updateDept(Dept dept);
}

applicationContext-mybatis.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.xsd
   http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
   http://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.xsd
   http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd">

   <!-- 构造SqlSessionFactory -->
   <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
      <!-- 定义数据源 -->
      <property name="dataSource" ref="dataSource"/>
      <!-- mybatis-config.xml -->
      <property name="configLocation" value="classpath:mybatis/mybatis-config.xml"/>
      <!-- 别名包 -->
      <property name="typeAliasesPackage" value="cn.tarena.ht.pojo"/>
      <!-- mapper.xml -->
      <property name="mapperLocations" value="classpath:mybatis/mappers/*.xml"/>
   </bean>
   
   <!-- 定义Mapper接口扫描器 -->
   <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
      <!-- 扫描mapper包 -->
      <property name="basePackage" value="cn.tarena.ht.mapper"/>
   </bean>

</beans>

applicationContext-shiro.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:context="http://www.springframework.org/schema/context"
   xmlns:aop="http://www.springframework.org/schema/aop"
   xmlns:tx="http://www.springframework.org/schema/tx"
   xsi:schemaLocation="http://www.springframework.org/schema/beans 
                     http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                     http://www.springframework.org/schema/context
                     http://www.springframework.org/schema/context/spring-context-3.0.xsd
                     http://www.springframework.org/schema/tx
                     http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
                     http://www.springframework.org/schema/aop 
                     http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">

   <!--将Shiro的全部的组件以bean的形式交给Spring管理  -->
    <bean id="lifeCycleBeanProcessor" 
    class="org.apache.shiro.spring.LifecycleBeanPostProcessor"></bean>
    
   
   <!--为Shiro形成切面,将来以AOP的形式进行调用  -->
    <bean 
    class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"
    depends-on="lifeCycleBeanProcessor">
      <!--表示以cglib生成代理对象
         1.有无接口 都可以生成代理对象
         2.代理对象是目标对象的子类
         Shiro中必须以cglib的形式生成代理对象
       -->
      <property name="proxyTargetClass" value="true"></property>
    </bean>
   
   
   <!--以cgLib的形式生成AOP  -->
   <aop:aspectj-autoproxy proxy-target-class="true"></aop:aspectj-autoproxy>
   
   
   <!--该对象是Shiro中最重要的模块.  -->
    <bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
   
   
      <!--必须注入Relam提供真实的信息,方便做判断  -->
   
      <property name="realm" ref="AuthRealm"></property>
    </bean>
    
    
    <!--自定义Realm 是我们自己手动编写的.里边需要提供真实的用户数据  -->
    <bean id="AuthRealm" class="cn.tarena.ht.shiro.AuthRealm">
      
      <!--引入自定义的加密器  -->
      <property name="credentialsMatcher" ref="authCredential"></property>
    </bean>
   
    <bean id="authCredential" class="cn.tarena.ht.shiro.AuthCredential"></bean>
   
   
   <!--配置权限认证的通知  -->
    <bean  class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor">
      
      <!--表示注入安全中心,以后做校验  -->
      <property name="securityManager" ref="securityManager"></property>
    </bean>
    
   <!--该过滤器应该放置到web容器中,如果放置到Spring容器中将不起作用.  -->
    <bean id="shiroFilter"  class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
      <!--注入安全中心  -->
      <property name="securityManager" ref="securityManager"></property>
      
      
      <!--只要没有经过认证的请求,都会被拦截到指定页面  -->
      <property name="loginUrl" value="/index.jsp"></property>
    
      <property name="filterChainDefinitions">
      <value>
         <!--如果什么都不加比较无需拦截,直接跳转
            
            /*  表示只拦截请求  不拦截静态资源文件
            /**  表示拦截全部的资源  包括请求和静态资源文件
            
            authc 表示拦截
            anon  表示放行
           -->
         /toLogin.action = anon
         /login.action = anon
         /staticfile/** = anon
         /** = authc
         
      </value>
      </property>
    
    </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.xsd
   http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
   http://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.xsd
   http://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>
         <!--定义查询方法都是只读的 -->
         <tx:method name="query*" read-only="true" />
         <tx:method name="find*" read-only="true" />
         <tx:method name="get*" read-only="true" />

         <!-- 主库执行操作,事务传播行为定义为默认行为 -->
         <tx:method name="save*" propagation="REQUIRED" />
         <tx:method name="update*" propagation="REQUIRED" />
         <tx:method name="delete*" propagation="REQUIRED" />

         <!--其他方法使用默认事务策略 -->
         <tx:method name="*" read-only="true"/>
      </tx:attributes>
   </tx:advice>

   <aop:config>
      <!-- 定义切面,所有的service的所有方法 -->
      <aop:pointcut id="txPointcut" expression="execution(* cn.tarena.ht.service..*.*(..))" />
      <!-- 应用事务策略到Service切面 -->
      <aop:advisor advice-ref="txAdvice" pointcut-ref="txPointcut"/>
   </aop:config>
   
   
</beans>

DeptController

package cn.tarena.ht.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import cn.tarena.ht.pojo.Dept;
import cn.tarena.ht.service.DeptService;

@Controller
@RequestMapping("/sysadmin/dept/")
public class DeptControllr {
   
   @Resource
   private DeptService deptService;
   
   @RequestMapping("list")
   public String findList(Model model){
      List<Dept> deptList = deptService.findAll();
      model.addAttribute("deptList", deptList);
      
      //跳转到部门列表页面
      return "sysadmin/dept/jDeptList";
   }
   
   
   
   
   //状态的改变
   @RequestMapping("stop")
   public String toStop(@RequestParam(value="deptId",required=true) String[] deptIds){
      
      int state = 0;  //表示状态停用
      deptService.updateState(deptIds,state);
      
      //重定向到部门列表页面
      return "redirect:/sysadmin/dept/list";
   }
   
   @RequestMapping("start")
   public String toStart(@RequestParam(value="deptId",required=true) String[] deptIds){
      int state = 1;  //表示状态停用
      deptService.updateState(deptIds,state);
      
      //重定向到部门列表页面
      return "redirect:/sysadmin/dept/list";
   }
   
   //部门删除
   @RequestMapping("delete")
   public String toDelete(@RequestParam(value="deptId",required=true)String[] deptIds){
      
      deptService.deleteDepts(deptIds);
      
      return "redirect:/sysadmin/dept/list";
   }
   
   
   //跳转部门新增页面
   @RequestMapping("tocreate")
   public String toCreate(Model model){
      
      //查询部门全部列表数据
      List<Dept> parentDeptList = deptService.findAll();
      model.addAttribute("parentDeptList", parentDeptList);
      
      return "sysadmin/dept/jDeptCreate";
   }
   
   @RequestMapping("save")
   public String saveDept(Dept dept){
      
      deptService.saveDept(dept);
      
      return "redirect:/sysadmin/dept/list";
   }
   
   @RequestMapping("toupdate")
   public String updateDept(String deptId,Model model){
      
      //准备修改数据
      Dept dept = deptService.findOne(deptId);
      
      //准备上级部门的下拉列表
      List<Dept> parentList = deptService.findAll();
      model.addAttribute("dept", dept);
      model.addAttribute("parentList", parentList);
      
      return "sysadmin/dept/jDeptUpdate";
   }
   
   @RequestMapping("update")
   public String updateDept(Dept dept){
      
      deptService.updateDept(dept);
      
      return "redirect:/sysadmin/dept/list";
   }
   
   
   //部门查看
   @RequestMapping("toview")
   public String toView(String deptId,Model model){
      
      Dept dept = deptService.findOne(deptId);
      model.addAttribute("dept", dept);
      
      //跳转到查看页面
      return "sysadmin/dept/jDeptView";
   }
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
}

Dept

package cn.tarena.ht.pojo;
//部门对象
public class Dept extends BaseEntity{
   private String deptId;
   private Dept parentDept;  //一对一关联关系
   private String deptName;  //部门名称
   private Integer state;   //部门状态    1启用 0停用
   
   
   public String getDeptId() {
      return deptId;
   }
   public void setDeptId(String deptId) {
      this.deptId = deptId;
   }
   public Dept getParentDept() {
      return parentDept;
   }
   public void setParentDept(Dept parentDept) {
      this.parentDept = parentDept;
   }
   public String getDeptName() {
      return deptName;
   }
   public void setDeptName(String deptName) {
      this.deptName = deptName;
   }
   public Integer getState() {
      return state;
   }
   public void setState(Integer state) {
      this.state = state;
   }
   @Override
   public String toString() {
      return "Dept [deptId=" + deptId + ", parentDept=" + parentDept + ", deptName=" + deptName + ", state=" + state
            + "]";
   }
   
   

}

DeptService

package cn.tarena.ht.service;

import java.util.List;

import cn.tarena.ht.pojo.Dept;

public interface DeptService {
   public List<Dept> findAll();

   public void updateState(String[] deptIds, int state);

   public void deleteDepts(String[] deptIds);

   public void saveDept(Dept dept);

   public Dept findOne(String deptId);

   public void updateDept(Dept dept);
}

DeptServiceImpl

package cn.tarena.ht.service.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.tarena.ht.mapper.DeptMapper;
import cn.tarena.ht.pojo.Dept;
import cn.tarena.ht.service.DeptService;
@Service
public class DeptServiceImpl implements DeptService {
   
   @Autowired
   private DeptMapper deptMapper;
   
   @Override
   public List<Dept> findAll() {
      
      return deptMapper.findAll();
   }

   @Override
   public void updateState(String[] deptIds, int state) {
      
      deptMapper.updateState(deptIds,state);
   }

   @Override
   public void deleteDepts(String[] deptIds) {
      
      deptMapper.deleteDepts(deptIds);
      
   }

   @Override
   public void saveDept(Dept dept) {
      
      dept.setCreateTime(new Date());  //添加新增日期
      deptMapper.saveDept(dept);
      
   }

   @Override
   public Dept findOne(String deptId) {
      
      return deptMapper.findOne(deptId);
   }

   @Override
   public void updateDept(Dept dept) {
      dept.setUpdateTime(new Date());
      deptMapper.updateDept(dept);
      
   }

}

pom.xml

<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>cn.tedu</groupId>
  <artifactId>HT1703</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>HT1703 Maven Webapp</name>
  <url>http://maven.apache.org</url>
   <!-- 集中定义依赖版本号 -->
   <properties>
      <junit.version>4.12</junit.version>
      <spring.version>4.2.3.RELEASE</spring.version>
         
      <mybatis.version>3.2.8</mybatis.version>
      <mybatis.spring.version>1.2.2</mybatis.spring.version>
      <mybatis.paginator.version>1.2.15</mybatis.paginator.version>
      <mysql.version>5.1.32</mysql.version>
      <bonecp-spring.version>0.8.0.RELEASE</bonecp-spring.version>
      <druid.version>1.0.9</druid.version>

      <mapper.version>2.3.2</mapper.version>
      <pagehelper.version>3.4.2</pagehelper.version>
      <jsqlparser.version>0.9.1</jsqlparser.version>

      <slf4j.version>1.6.4</slf4j.version>
      <jstl.version>1.2</jstl.version>
      <servlet-api.version>2.5</servlet-api.version>
      <jsp-api.version>2.0</jsp-api.version>
      <jackson.version>2.4.2</jackson.version>
      
   </properties>
   
   <dependencies>
      <!-- Spring -->
      <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-context</artifactId>
         <version>${spring.version}</version>
      </dependency>
      <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-webmvc</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-aspects</artifactId>
         <version>${spring.version}</version>
      </dependency>
      
      <!-- Mybatis -->
      <dependency>
         <groupId>org.mybatis</groupId>
         <artifactId>mybatis</artifactId>
         <version>${mybatis.version}</version>
      </dependency>
      <dependency>
         <groupId>org.mybatis</groupId>
         <artifactId>mybatis-spring</artifactId>
         <version>${mybatis.spring.version}</version>
      </dependency>
      <dependency>
         <groupId>com.github.miemiedev</groupId>
         <artifactId>mybatis-paginator</artifactId>
         <version>${mybatis.paginator.version}</version>
      </dependency>  
                  
      <!-- 通用Mapper,所有的单表的代码都不用编写 -->
      <dependency>
         <groupId>com.github.abel533</groupId>
         <artifactId>mapper</artifactId>
         <version>${mapper.version}</version>
      </dependency>
      
      <!--转化JSON的工具  -->
      <dependency>
         <groupId>com.fasterxml.jackson.core</groupId>
         <artifactId>jackson-databind</artifactId>
         <version>${jackson.version}</version>
      </dependency>
      
      
      <!-- Oracle版权问题,maven目录必须自己手动建立 -->
      <dependency> 
         <groupId>com.oracle</groupId>
         <artifactId>ojdbc6</artifactId>
         <version>11.1.0.7.0</version>
      </dependency>

      <!-- MySql -->
      <dependency>
         <groupId>mysql</groupId>
         <artifactId>mysql-connector-java</artifactId>
         <version>${mysql.version}</version>
      </dependency>
      <!-- 超高性能连接池 -->
      <dependency>
         <groupId>com.zaxxer</groupId>
         <artifactId>HikariCP-java6</artifactId>
         <version>2.3.9</version>
         <scope>compile</scope>
      </dependency>  

      <!-- Apache Shiro 权限架构 -->
      <dependency>
         <groupId>org.apache.shiro</groupId>
         <artifactId>shiro-all</artifactId>
         <version>1.2.3</version>
      </dependency>  
      
      <!-- 分页插件 -->
      <dependency>
         <groupId>com.github.pagehelper</groupId>
         <artifactId>pagehelper</artifactId>
         <version>${pagehelper.version}</version>
      </dependency>
      <dependency>
         <groupId>com.github.jsqlparser</groupId>
         <artifactId>jsqlparser</artifactId>
         <version>${jsqlparser.version}</version>
      </dependency>

      <dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-log4j12</artifactId>
         <version>${slf4j.version}</version>
      </dependency>

      <!-- JSP相关 -->
      <dependency>
         <groupId>jstl</groupId>
         <artifactId>jstl</artifactId>
         <version>${jstl.version}</version>
      </dependency>
      <dependency>
         <groupId>javax.servlet</groupId>
         <artifactId>servlet-api</artifactId>
         <version>${servlet-api.version}</version>
         <scope>provided</scope>
      </dependency>
      <dependency>
         <groupId>javax.servlet</groupId>
         <artifactId>jsp-api</artifactId>
         <version>${jsp-api.version}</version>
         <scope>provided</scope>
      </dependency>

      <!-- 字符加密、解密 -->
      <dependency>
         <groupId>commons-codec</groupId>
         <artifactId>commons-codec</artifactId>
         <version>1.9</version>
      </dependency>

      <!-- 数据校验 -->
      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-validator</artifactId>
         <version>5.1.3.Final</version>
      </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>4.2.3.RELEASE</version>
        </dependency>
    </dependencies>
   <build>
      <plugins>
         <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.2</version>
            <configuration>
               <port>8090</port>
               <path>/</path>
            </configuration>
         </plugin>
      </plugins>
   </build>
</project>

© 著作权归作者所有

architect刘源源

architect刘源源

粉丝 169
博文 564
码字总数 941209
作品 0
浦东
程序员
私信 提问
怎么搭建SSM框架

myeclipse的8.5版本,用web project工程能否搭建ssm框架?因为大家都是maven和ssm的整合,我就想知道webProject能不能和ssm整合,还需要注意一些什么问题,请各位指点一下。...

行走的思想
2018/03/06
488
2
springboot+mybatis+springmvc整合实例

以往的ssm框架整合通常有两种形式,一种是xml形式,一种是注解形式,不管是xml还是注解,基本都会有一大堆xml标签配置,其中有很多重复性的。springboot带给我们的恰恰是“零配置”,"零配置...

youcongtech
2018/03/25
0
0
SSM 整合步骤

要快速学习SSM框架,你需要一套学习曲线平滑的教程 1. 很快可以看到效果 SSM框架这种教程的,在百度或者git上一搜一大把,不过很遗憾,大部分你照着上面的流程做,是做不出来的,要么缺少包,...

maocai15
2017/04/26
3K
2
SSM框架 (Spring+SpringMVC+MyBatis)

SSM框架——详细整合教程(Spring+SpringMVC+MyBatis) springspringmvcmybatis整合教程ssm整合 1、基本概念 1.1、Spring Spring是一个开源框架,Spring是于2003 年兴起的一个轻量级的Java ...

YaZi-Liu
2015/10/15
3.5K
0
【Spring boot实践】Spring boot 认识

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Rsx/article/details/89003901 文章目录 Spring boot 简介 Spring boot是spring 家族中的一个全新的框架,它用...

不专业得Cook-任晓帅
04/03
0
0

没有更多内容

加载失败,请刷新页面

加载更多

Centos7 安装zabbix-agent

rpm -i https://repo.zabbix.com/zabbix/4.2/rhel/6/x86_64/zabbix-release-4.2-2.el6.noarch.rpm 可以到https://repo.zabbix.com/zabbix找到对应的版本 yum install zabbix-agent -y 出现E......

abowu
昨天
8
0
文本编辑器GNU nano 4.4 发布

GNU nano 4.4 "Hagelslag" 更新日志: 启动时,光标可以放在第一个或最后一个出现位置 字符串前面带有+/string 或 +?string的字符串。 发生自动硬包装时((--breaklonglines),任何前导引号...

linuxCool
昨天
7
0
你知道字节序吗

字节序 最近在调一个自定义报文的接口时,本来以为挺简单的,发现踩了好几个坑,其中一个比较“刻骨铭心”的问题就是数据的字节序问题。 背景 自定义报文,调用接口,服务端报文解析失败 iO...

杭城小刘
昨天
3
0
设计模式之依赖倒置原则

方法

东风破2019
昨天
6
0
关于如何通过模拟器完成模拟步数提升傻瓜式解决方案(囧)

因为对Android开发不太了解,也没去问朋友所以误打误撞找到的一个提升步数的解决方案,当然只是针对某安APP运动RUN的解决方式吧。 对Android不太了解,所以找了很多的解决方案来看看能不能破...

华山猛男
昨天
5
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部