spring + springmvc+mybatis+maven配置

今天由于项目需要,简单的配置了一下ssm框架,maven配置所需包,可直接粘贴复制

maven依赖

 

   

      junit

      junit

      test

   

   

      com.alibaba

      fastjson

      1.2.29

   

   

      commons-fileupload

      commons-fileupload

      1.3.2

   

   

      org.codehaus.jackson

      jackson-mapper-lgpl

      1.9.13

   

   

      jstl

      jstl

      1.2

   

   

      org.springframework

      spring-core

      3.2.18.RELEASE

   

   

      org.springframework

      spring-beans

      3.2.18.RELEASE

   

   

      org.springframework

      spring-aspects

      3.2.18.RELEASE

   

   

      org.springframework

      spring-webmvc

      3.2.18.RELEASE

   

   

      org.springframework

      spring-aop

      3.2.18.RELEASE

   

   

      org.springframework

      spring-context

      3.2.18.RELEASE

   

   

      org.springframework

      spring-tx

      3.2.18.RELEASE

   

   

      org.springframework

      spring-jdbc

      3.2.18.RELEASE

   

   

      org.mybatis

      mybatis

      3.4.2

   

   

      org.mybatis

      mybatis-spring

      1.3.1

   

   

      com.alibaba

      druid

      1.0.28

   

   

      org.slf4j

      slf4j-log4j13

      1.0.1

   

   

      org.apache.struts.xwork

      xwork-core

      2.3.31

   


   

      junit

      junit

      RELEASE

   


   

      org.apache.commons

      commons-dbcp2

      2.1.1

   

   

      jfreechart

      jfreechart

      1.0.0

   

   

      jcommon

      jcommon

      0.9.5

   

   

      com.google.code.gson

      gson

      2.3.1

   


   

      commons-beanutils

      commons-beanutils

      1.4.1

   

   

      commons-codec

      commons-codec

      1.5

   

   

      commons-collections

      commons-collections

      3.2

   

   

      commons-lang

      commons-lang

      2.3

   

   

      commons-lang

      commons-lang

      2.2

   

 

      org.apache.httpcomponents

      httpclient

      4.1.2

   


   

      postgresql

      postgresql

      8.3-603.jdbc4

   

   

   

      javax.servlet

      javax.servlet-api

      3.0.1

      provided

   

   

      javax.servlet.jsp

      jsp-api

      2.1

      provided

   

   

      javax.servlet

      jstl

      1.2

   

   

 

由于ide的集成环境不同, intellij IDEA需要加入以下的build,不然他不会解析xml文件,IDEA的一个小bug。elipse没有

    kaiYou

     

       

          org.apache.maven.plugins

          maven-compiler-plugin

         

            1.6

            1.6

         

       

     

     

     

       

          src/main/java

         

            **/*.xml

         

          true

       

     

   

Spring + SpringMVC + mybatis配置,可以直接粘贴复制使用用,只需要修改其中的文件夹路径和数据库语句即可

config.properties

#hibernate.dialect=org.hibernate.dialect.OracleDialect

#driverClassName=oracle.jdbc.driver.OracleDriver

#validationQuery=SELECT 1 FROM DUAL

#jdbc_url=jdbc:oracle:thin:@localhost:1521:orcl

#jdbc_username=root

#jdbc_password=root

#hibernate.dialect=org.hibernate.dialect.MySQLDialect

#driverClassName=com.mysql.jdbc.Driver

validationQuery=SELECT 1

jdbc_url=jdbc:postgresql://192.168.3.101:5432/opengame?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull

jdbc_username=postgres

jdbc_password=yjkj8888

#hibernate.dialect=org.hibernate.dialect.SQLServerDialect

#driverClassName=net.sourceforge.jtds.jdbc.Driver

#validationQuery=SELECT 1

#jdbc_url=jdbc:jtds:sqlserver://127.0.0.1:1433/test

#jdbc_username=sa

#jdbc_password=123456

#hibernate.dialect=org.hibernate.dialect.DerbyDialect

#driverClassName=org.apache.derby.jdbc.EmbeddedDriver

#validationQuery=SELECT 1

#jdbc_url=jdbc:derby:test;create=true

#jdbc_username=root

#jdbc_password=root

#jndiName=java:comp/env/dataSourceName

hibernate.hbm2ddl.auto=update

hibernate.show_sql=false

hibernate.format_sql=true

sessionInfoName=sessionInfo

uploadFieldName=filedata

uploadFileMaxSize=20971520

uploadFileExts=txt,rar,zip,doc,docx,xls,xlsx,jpg,jpeg,gif,png,swf,wmv,avi,wma,mp3,mid

uploadDirectory=attached

log4j.properties

log4j.rootLogger=DEBUG,Console,File


log4j.appender.Console=org.apache.log4j.ConsoleAppender

log4j.appender.Console.Target=System.out

log4j.appender.Console.layout=org.apache.log4j.PatternLayout

log4j.appender.Console.layout.ConversionPattern=[%c]%m%n


log4j.appender.File=org.apache.log4j.RollingFileAppender 

log4j.appender.File.File=mybatis.log

log4j.appender.File.MaxFileSize=10MB

log4j.appender.File.Threshold=ALL

log4j.appender.File.layout=org.apache.log4j.PatternLayout

log4j.appender.File.layout.ConversionPattern=[%p][%d{yyyy-MM-dd HH\:mm\:ss,SSS}][%c]%m%n

spring.xml


xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"

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">





spring-mvc.xml

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/context

        http://www.springframework.org/schema/context/spring-context.xsd

        http://www.springframework.org/schema/mvc

http://www.springframework.org/schema/mvc/spring-mvc.xsd">




class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">

text/html;charset=UTF-8


class="org.springframework.web.servlet.view.InternalResourceViewResolver"

p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" />


class="org.springframework.web.multipart.commons.CommonsMultipartResolver">

UTF-8

32505856

4096




spring-mybatis.xml

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"

xmlns:aop="http://www.springframework.org/schema/aop"

xsi:schemaLocation="

http://www.springframework.org/schema/beans 

http://www.springframework.org/schema/beans/spring-beans-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">


init-method="init" destroy-method="close">










class="org.springframework.jdbc.datasource.DataSourceTransactionManager">





expression="execution(* com.yjkj.service..*Impl.*(..))" />

advice-ref="transactionAdvice" />



class="com.alibaba.druid.support.spring.stat.DruidStatInterceptor">

scope="prototype">

com.yjkj.service.*

pointcut-ref="druid-stat-pointcut" />


你可能感兴趣的:(spring + springmvc+mybatis+maven配置)