web.xml:
可以把<property name="annotatedClasses">
改成
<property name="packagesToScan">
<list>
<value>com.***.***</value>
</list>
</property>
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<!-- 连接池自带监控程序 -->
<servlet>
<servlet-name>ProxoolAdmin</servlet-name>
<servlet-class>
org.logicalcobwebs.proxool.admin.servlet.AdminServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ProxoolAdmin</servlet-name>
<url-pattern>/ProxoolAdmin.svl</url-pattern>
</servlet-mapping>
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>com.community.interceptor.EncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<!-- Spring 刷新Introspector防止内存泄露 -->
<listener>
<listener-class>
org.springframework.web.util.IntrospectorCleanupListener
</listener-class>
</listener>
<!-- 容器监听器便于清零服务器异常中断导致错误的用户登录状态 -->
<listener>
<listener-class>com.community.interceptor.WebContainerListener</listener-class>
</listener>
<!-- session监听器,便于用户session超时清零用户登录状态 -->
<listener>
<listener-class>com.community.interceptor.SessionListener</listener-class>
</listener>
<servlet>
<servlet-name>Kaptcha</servlet-name>
<servlet-class>com.google.code.kaptcha.servlet.KaptchaServlet</servlet-class>
<init-param>
<param-name>kaptcha.textproducer.char.string</param-name>
<param-value>abcde2345678gfynmnpwx2345678ABCDEGFYNMNPWX</param-value>
</init-param>
<init-param>
<param-name>kaptcha.textproducer.font.size</param-name>
<param-value>45</param-value>
</init-param>
<init-param>
<param-name>kaptcha.textproducer.char.length</param-name>
<param-value>5</param-value>
</init-param>
<init-param>
<param-name>kaptcha.image.width</param-name>
<param-value>200</param-value>
</init-param>
<init-param>
<param-name>kaptcha.image.height </param-name>
<param-value>50</param-value>
</init-param>
<init-param>
<param-name>kaptcha.textproducer.font.color </param-name>
<param-value>204,139,193</param-value>
</init-param>
<init-param>
<param-name>kaptcha.noise.color </param-name>
<param-value>204,139,193</param-value>
</init-param>
<init-param>
<param-name>kaptcha.background.clear.from </param-name>
<param-value>white</param-value>
</init-param>
<init-param>
<param-name>kaptcha.background.clear.to </param-name>
<param-value>white</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Kaptcha</servlet-name>
<url-pattern>/kaptcha.jpg</url-pattern>
</servlet-mapping>
<!-- session超时定义,单位为分钟 -->
<session-config>
<session-timeout>100</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
applicationContext.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:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"
default-lazy-init="true">
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>classpath:jdbc.properties</value>
<!--
<value>/WEB-INF/jdbc.properties</value>
-->
</property>
</bean>
<bean id="dataSource" class="org.logicalcobwebs.proxool.ProxoolDataSource">
<property name="driver" value="${db.driver}"/>
<property name="driverUrl" value="${db.url}"/>
<property name="user" value="${db.user}"/>
<property name="password" value="${db.password}"/>
<property name="alias" value="${db.alias}"/>
<property name="houseKeepingTestSql" value="${db.houseKeepingTestSql}"/>
<property name="maximumConnectionCount" value="${db.maximumConnectionCount}"/>
<property name="minimumConnectionCount" value="${db.minimumConnectionCount}"/>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<!-- 引用数据源 -->
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="annotatedClasses">
<list>
<value>com.community.entity.ClubCity</value>
<value>com.community.entity.ClubOwnerUser</value>
<value>com.community.entity.ClubUser</value>
<value>com.community.entity.ClubDealer</value>
<value>com.community.entity.ClubProvince</value>
<value>com.community.entity.ClubMember</value>
<value>com.community.entity.ClubExpert</value>
<value>com.community.entity.ClubExpertTips</value>
<value>com.community.entity.ClubNews</value>
<value>com.community.entity.ClubNewsEntry</value>
<value>com.community.entity.ClubNewsTags</value>
<value>com.community.entity.ClubNewsType</value>
<value>com.community.entity.ClubTipsTag</value>
<value>com.community.entity.ClubTipsType</value>
<value>com.community.entity.FordCar</value>
<value>com.community.entity.FordClubMember</value>
<value>com.community.entity.ForumAccess</value>
<value>com.community.entity.ForumDating</value>
<value>com.community.entity.ForumDegreeDescription</value>
<value>com.community.entity.ForumFolder</value>
<value>com.community.entity.ForumFriend</value>
<value>com.community.entity.ForumGradeSwap</value>
<value>com.community.entity.ForumGroupFriend</value>
<value>com.community.entity.ForumInformation</value>
<value>com.community.entity.ForumLoginUser</value>
<value>com.community.entity.ForumMainModule</value>
<value>com.community.entity.ForumMessage</value>
<value>com.community.entity.ForumModerator</value>
<value>com.community.entity.ForumModule</value>
<value>com.community.entity.ForumPosts</value>
<value>com.community.entity.ForumRankRolus</value>
<value>com.community.entity.ForumReplicationMessage</value>
<value>com.community.entity.ForumReplyThread</value>
<value>com.community.entity.ForumSignature</value>
<value>com.community.entity.ForumSpeak</value>
<value>com.community.entity.ForumThread</value>
<value>com.community.entity.ForumUserModule</value>
<value>com.community.entity.ForumUserRank</value>
<value>com.community.entity.ForumMd5pwd</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.format_sql">false</prop>
<prop key="hibernate.jdbc.fetch_size">20</prop>
<prop key="hibernate.query.substitutions">true 1, false 0</prop>
<prop key="hibernate.jdbc.batch_size">20</prop>
<prop key="hibernate.cache.use_structured_entries">true</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<prop key="hibernate.cache.provider_configuration_file_resource_path"></prop>
</props>
</property>
</bean>
<!-- 事务配置 -->
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<!-- 使用annotation 自动注册bean,并检查@Required,@Autowired的属性已被注入 -->
<context:annotation-config/>
<context:component-scan base-package="com.community" />
<!-- 使用annotation定义事务 -->
<tx:annotation-driven transaction-manager="txManager" />
</beans>
jdbc.properties:
db.driver=oracle.jdbc.driver.OracleDriver
db.url=jdbc:oracle:thin:@172.16.22.10:1521:crm
db.user=crm
db.password=p
db.alias=OraclePool
db.houseKeepingTestSql=select 1
db.characterEncoding=GBK
db.maximumConnectionCount=30
db.minimumConnectionCount=5
struts.properties:
这个我不是太熟悉
struts.devMode = true
struts.configuration.xml.reload=true
struts.i18n.encoding=UTF-8
struts.action.extension=do,action
#struts.locale=en_us
struts.custom.i18n.resources=com/club/res/globalMessages
struts.objectFactory =spring
struts.multipart.maxSize=8388608
struts.enable.DynamicMethodInvocation=false
struts.enable.SlashesInActionNames=true
struts.xml:
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
"http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<package name="default" extends="struts-default">
<interceptors>
<interceptor name="singleLoginInterceptor"
class="com.community.interceptor.SingleLoginInterceptor">
</interceptor>
<interceptor name="sessionTimeoutInterceptor" class="com.community.interceptor.SessionTimeoutInterceptor" />
<interceptor name="checkCookieInterceptor" class="com.community.interceptor.CheckCookieInterceptor" />
</interceptors>
<global-results>
<result name="timeout" type="redirect" >timeoutMsg.jsp</result>
</global-results>
</package>
<package name="struts2ajax" extends="json-default">
</package>
</struts>