码迷,mamicode.com
首页 > 编程语言 > 详细

请见Maven构建JAVAEE SSH 配置(下)

时间:2015-11-03 00:25:42      阅读:276      评论:0      收藏:0      [点我收藏+]

标签:

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>com.lenggirl</groupId> <!-- 项目名 -->
    <artifactId>hunterhug</artifactId> <!--构建名 -->
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>hunterhug Maven Webapp</name>
    <url>http://maven.apache.org</url>

    <properties>
        <hibernate.version>3.5.6-Final</hibernate.version>
        <spring.version>3.1.2.RELEASE</spring.version>
        <spring.security.version>3.1.2.RELEASE</spring.security.version>
    </properties>


    <!-- spring依赖(只有这么多) -->
    <dependencies>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>

        <!-- spring 相关包 -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-asm</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aspects</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</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-struts</artifactId> 
            <version>${spring.version}</version> </dependency> -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-expression</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-instrument</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jms</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-oxm</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc-portlet</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-orm</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-commons-core</artifactId>
            <version>1.4.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>${spring.security.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>${spring.security.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${spring.security.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-taglibs</artifactId>
            <version>${spring.security.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-acl</artifactId>
            <version>${spring.security.version}</version>
        </dependency>

        <!--proxool数据库连接池 -->
        <dependency>
            <groupId>proxool</groupId>
            <artifactId>proxool</artifactId>
            <version>0.9.1</version>
        </dependency>
        <dependency>
            <groupId>proxool</groupId>
            <artifactId>proxool-cglib</artifactId>
            <version>0.9.1</version>
        </dependency>

        <!-- mysql驱动 -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.26</version>
        </dependency>
        <!-- c3p0数据源 -->
        <dependency>
            <groupId>c3p0</groupId>
            <artifactId>c3p0</artifactId>
            <version>0.9.1</version>
        </dependency>

        <!-- 缓存 -->
        <dependency>
            <groupId>net.sf.ehcache</groupId>
            <artifactId>ehcache</artifactId>
            <version>2.7.2</version>
        </dependency>

        <!-- hibernate相关包 -->
        <!-- hibernate核心类库 -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate.version}</version>
            <!-- 排除依赖 -->
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
                <exclusion>
                    <artifactId>antlr</artifactId>
                    <groupId>antlr</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- 语言转换工具,实现HQL到SQL的转换 -->
        <dependency>
            <groupId>antlr</groupId>
            <artifactId>antlr</artifactId>
            <version>2.7.6</version>
        </dependency>
        <!-- 对JPA规范的支持 -->
        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId><!-- 注解包 -->
            <artifactId>hibernate-jpa-2.0-api</artifactId>
            <version>1.0.1.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-annotations</artifactId>
            <version>${hibernate.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>javax.transaction</groupId>
            <artifactId>jta</artifactId>
            <version>1.1</version>
        </dependency>

        <!-- 文件上传依赖 -->
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.3</version>
        </dependency>
        <!-- IO输入输出依赖 -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.4</version>
        </dependency>
        <!-- 数据类型工具依赖 -->
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.6</version>
        </dependency>

        <!-- log4j必须引入 -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.1</version>
        </dependency>

        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.6.8</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
        </dependency>

        <dependency>
            <groupId>net.sf.json-lib</groupId>
            <artifactId>json-lib</artifactId>
            <version>2.2.2</version>
            <classifier>jdk15</classifier>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>javassist</groupId>
            <artifactId>javassist</artifactId>
            <version>3.11.0.GA</version>
        </dependency>


    </dependencies>

    <!-- 远程仓库 -->
    <repositories>
        <repository>
            <id>maven-net-cn</id>
            <name>Maven China Mirror</name>
            <url>http://maven.oschina.net/content/groups/public/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>maven-net-cn</id>
            <name>Maven China Mirror</name>
            <url>http://maven.oschina.net/content/groups/public/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

    <build>
        <finalName>hunterhug</finalName>
    </build>


</project>

 

 

web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <!-- 该元素用来声明应用范围(整个WEB项目)内的上下文初始化参数。 -->
    <!-- 区分项目名称,防止默认重名 -->
    <context-param>
        <param-name>webAppRootKey</param-name>
        <param-value>hunterhug</param-value>
    </context-param>
    
    <!-- spring配置文件所在位置 -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring/spring.xml</param-value>
    </context-param>
    
    <!-- 日志配置所在位置-->
    <context-param>
        <param-name>log4jConfigLocation</param-name>
        <param-value>/WEB-INF/log/log4j.properties</param-value>
    </context-param>

    <!--开一条watchdog线程每6秒扫描一下配置文件的变化 -->
    <context-param>
        <param-name>log4jRefreshInterval</param-name>
        <param-value>6000</param-value>
    </context-param>

    <!-- 字符集 过滤器 -->
    <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>
        <init-param>
            <param-name>forceEncoding</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>CharacterEncodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!-- 日志监听器 -->
    <listener>
        <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
    </listener>

    <!-- spring各种配置加载 -->
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <!-- spring分发器 -->
    <servlet>
        <servlet-name>dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/spring/dispatcher-servlet.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>dispatcher</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>

    <!-- 必须开启,否则没有spring session -->
    <filter>
        <filter-name>OpenSessionInViewFilter</filter-name>
        <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
    </filter>
    
    <filter-mapping>
        <filter-name>OpenSessionInViewFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!-- 欢迎页 -->
    <welcome-file-list>
        <welcome-file>index.do</welcome-file>
    </welcome-file-list>
</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:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc" 
       xmlns:tx="http://www.springframework.org/schema/tx" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/aop 
        http://www.springframework.org/schema/aop/spring-aop-3.0.xsd 
        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/mvc 
        http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd 
        http://www.springframework.org/schema/tx 
        http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
    <import resource="base.xml" />
     <import resource="hibernate.xml" /> 
     <import resource="transaction.xml" />
    
</beans>

 

base.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:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc" 
       xmlns:tx="http://www.springframework.org/schema/tx" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/aop 
        http://www.springframework.org/schema/aop/spring-aop-3.0.xsd 
        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/mvc 
        http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd 
        http://www.springframework.org/schema/tx 
        http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
      
    <context:annotation-config></context:annotation-config>
      <!-- 组件自动扫描-->
    <context:component-scan base-package="com.lenggirl"/>
    <!-- 对@Aspectj面向切面注解的支持 -->
    <aop:aspectj-autoproxy />
</beans>

 

dispacher-servlet.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:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc" 
       xmlns:tx="http://www.springframework.org/schema/tx" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/aop 
        http://www.springframework.org/schema/aop/spring-aop-3.0.xsd 
        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/mvc 
        http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd 
        http://www.springframework.org/schema/tx 
        http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

    <mvc:annotation-driven />
    <context:component-scan base-package="com.lenggirl" />

    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/jsp/" />
        <property name="suffix" value=".jsp" />
    </bean>

</beans>

 

hibernate.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:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc" 
       xmlns:tx="http://www.springframework.org/schema/tx" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/aop 
        http://www.springframework.org/schema/aop/spring-aop-3.0.xsd 
        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/mvc 
        http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd 
        http://www.springframework.org/schema/tx 
        http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
      
    <bean id="propertyConfigurer"
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>/WEB-INF/classes/jdbc/jdbc.properties</value>
            </list>
        </property>
    </bean>
        <!-- proxool数据源开始  -->
<!--         <bean id="dataSource" class="org.logicalcobwebs.proxool.ProxoolDataSource" > -->
        <bean id="dataSource" class="com.lenggirl.util.ProxoolBugFix" >
            <property name="driver" value="${jdbc.driverClassName}"></property>
            <property name="driverUrl" value="${jdbc.url}"></property>
            <property name="user" value="${jdbc.username}"></property>
            <property name="password" value="${jdbc.password}"></property>
            <property name="alias" value="${jdbc.proxool.alias}"></property>
            <property name="houseKeepingSleepTime" value="${jdbc.proxool.houseKeepingSleepTime}"></property >
            <property name="maximumActiveTime" value="${jdbc.proxool.maximumActiveTime}"></property>
            <property name="maximumConnectionLifetime" value="${jdbc.proxool.maximumConnectionLifetime}"></property>
            <property name="prototypeCount" value="${jdbc.proxool.prototypeCount}"></property>
            <property name="minimumConnectionCount" value="${jdbc.proxool.minimumConnectionCount}"></property>
            <property name="maximumConnectionCount" value="${jdbc.proxool.maximumConnectionCount}"></property>
            <property name="houseKeepingTestSql" value="${jdbc.proxool.houseKeepingTestSql}"></property>
            <property name="simultaneousBuildThrottle" value="${jdbc.proxool.simultaneousBuildThrottle}"></property>
            <property name="statistics" value="${jdbc.proxool.statistics}"></property>
            <property name="statisticsLogLevel" value="${jdbc.proxool.statisticsLogLevel}"></property>
            <property name="trace" value="${jdbc.proxool.trace}"></property>
            <property name="verbose" value="${jdbc.proxool.verbose}"></property>
        </bean>

 
    <bean id="sessionFactory"
            class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="packagesToScan" >
            <list>
                <value>com.lenggirl.hunterhug.*.entity</value>
            </list>
           </property>
           <property name="mappingDirectoryLocations">
            <list>
                <value>${hibernate.mappingDirectory}</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">${hibernate.dialect}</prop>
                <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
                <prop key="hibernate.connection.autocommit">${hibernate.connection.autocommit}</prop> 
                <!--<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>-->
                <prop key="net.sf.ehcache.configurationResourceName">${hibernate.cache.provider_configuration_file_resource_path}</prop>
                <prop key="com.opensymphony.oscache.configurationResourceName">${hibernate.cache.provider_configuration_file_resource_path}</prop>
                <prop key="hibernate.cache.provider_class">${hibernate.cache.provider_class}</prop>
                <prop key="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}</prop>
                <prop key="hibernate.cache.use_second_level_cache">${hibernate.cache.use_second_level_cache}</prop>
                <prop key="hibernate.jdbc.batch_size">${hibernate.jdbc.batch_size}</prop>
                <prop key="hibernate.jdbc.fetch_size">${hibernate.jdbc.fetch_size}</prop>
                <prop key="hibernate.max_fetch_depth">${hibernate.max_fetch_depth}</prop>
            </props>
        </property>
        <property name="lobHandler" ref="lobHandler"></property>
    </bean>
    <bean id="lobHandler" class="org.springframework.jdbc.support.lob.DefaultLobHandler" lazy-init="true" />
</beans>

 

 

transaction.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:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc" 
       xmlns:tx="http://www.springframework.org/schema/tx" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/aop 
        http://www.springframework.org/schema/aop/spring-aop-3.0.xsd 
        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/mvc 
        http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd 
        http://www.springframework.org/schema/tx 
        http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<!-- Spring的事务管理 -->
<!-- 注解式事务-->
<!--  <tx:annotation-driven transaction-manager="transactionManager" />      -->
    <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory"><ref bean="sessionFactory"/></property>
    </bean>
    <tx:advice id="txProxyTemplate" transaction-manager="transactionManager" >
        <tx:attributes>
            <!-- 事务级别方法前缀配置,除已配置的前缀方法,其它方法都为只读事务,比如get,find等开头的方法 -->
            <!-- 一般来讲除非有特殊要求,以下配置的方法已适用于绝大多数情况(可修改事务方法名为该前缀),可以添加新的前缀 -->
           <tx:method name="add*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="deepCopy*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="update*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="move*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="delete*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="del*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="create*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="save*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="batch*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="bind*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="un*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="auto*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="start*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="submit*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="next*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="import*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="export*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="copy*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="paste*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="change*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="send*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="init*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="build*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="execute*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="sync*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="replace*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="transfer*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="freeze*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="resume*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="archive*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="mod*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="open*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="rise*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="assign*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="jump*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="rehandle*" propagation="REQUIRED" rollback-for="Exception"/>
          <tx:method name="show*" propagation="REQUIRED" rollback-for="Exception"/>
           <tx:method name="*" read-only="true"/>
          </tx:attributes>
    </tx:advice>

    <aop:config>
        <aop:pointcut id="tutorial-application"
            expression="execution(public * com.lenggirl..*Biz.*(..))" />
        <aop:advisor advice-ref="txProxyTemplate" pointcut-ref="tutorial-application" />
    </aop:config>
</beans>

 

log4j.properties
layoutPattern=[%d{HH:mm:ss}] %-5p : %m%n    
log.file=${message.web.root}/WEB-INF/log/app.log    
   
log4j.appender.logfile=org.apache.log4j.DailyRollingFileAppender    
log4j.appender.logfile.File=${log.file}    
log4j.appender.logfile.Append=true   
log4j.appender.logfile.DatePattern=‘.‘yyyyMMdd    
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout    
log4j.appender.logfile.layout.ConversionPattern=${layoutPattern}   

layoutPattern=[%d{HH:mm:ss}] %-5p : %m%n
log.file=${message.web.root}/WEB-INF/log/app.log    

log4j.appender.logfile=org.apache.log4j.DailyRollingFileAppender
log4j.appender.logfile.File=${log.file}
log4j.appender.logfile.Append=true
log4j.appender.logfile.DatePattern=‘.‘yyyyMMdd
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
log4j.appender.logfile.layout.ConversionPattern=${layoutPattern}

 

项目在此下载:http://pan.baidu.com/s/1jGnjX58

请见Maven构建JAVAEE SSH 配置(下)

标签:

原文地址:http://www.cnblogs.com/nima/p/4931682.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!