Created
September 29, 2012 05:51
-
-
Save MaySnow/3803311 to your computer and use it in GitHub Desktop.
ssh框架配置(基于注解)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd | |
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd | |
" | |
> | |
<!-- 开启自动扫描 基于注解Spring--> | |
<context:component-scan base-package="com.kaishengit"/> | |
<!-- 开启基于注解的事务 --> | |
<tx:annotation-driven transaction-manager="transactionManager"/> | |
<!-- Hibernate事务管理器 --> | |
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> | |
<property name="sessionFactory" ref="sessionFactory"></property> | |
</bean> | |
<!-- 配置sessionFactory --> | |
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> | |
<property name="dataSource" ref="dataSource"></property> | |
<property name="packagesToScan" value="com.kaishengit.pojo"/> | |
<property name="hibernateProperties"> | |
<props> | |
<prop key="hibernate.show_sql">true</prop> | |
<prop key="hibernate.dialect"> | |
org.hibernate.dialect.MySQLDialect | |
</prop> | |
<prop key="hibernate.cache.provider_class"> | |
org.hibernate.cache.EhCacheProvider | |
</prop> | |
<prop key="hibernate.cache.provider_configuration_file_resource_path"> | |
ehcache.xml | |
</prop> | |
</props> | |
</property> | |
</bean> | |
<!-- 配置数据源 --> | |
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"> | |
<property name="driverClass" value="com.mysql.jdbc.Driver"/> | |
<property name="jdbcUrl" value="jdbc:mysql:///todo"/> | |
<property name="maxIdleTime" value="25000"/> | |
<property name="properties"> | |
<props> | |
<prop key="user">root</prop> | |
<prop key="password">root</prop> | |
<prop key="c3p0.acquire_increment">2</prop> | |
<prop key="c3p0.max_size">20</prop> | |
<prop key="c3p0.min_size">1</prop> | |
</props> | |
</property> | |
</bean> | |
</beans> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<ehcache> | |
<diskStore path="java.io.tmpdir"/> | |
<defaultCache | |
maxElementsInMemory="10000" | |
eternal="false" | |
timeToIdleSeconds="120" | |
timeToLiveSeconds="120" | |
overflowToDisk="true" | |
/> | |
</ehcache> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE struts PUBLIC | |
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" | |
"http://struts.apache.org/dtds/struts-2.3.dtd"> | |
<struts> | |
<!-- 把value改成myPackage即与下面package的name相同,这样在下面的package可以定义global-results等 --> | |
<constant name="struts.convention.default.parent.package" value="myPackage"/> | |
<!-- 将默认的content修改为views文件夹 --> | |
<constant name="struts.convention.result.path" value="/WEB-INF/views/"/> | |
<package name="myPackage" extends="convention-default" > | |
</package> | |
</struts> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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"> | |
<display-name></display-name> | |
<!-- 字符集过滤器 --> | |
<filter> | |
<filter-name>springEncoding</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> | |
</filter> | |
<filter-mapping> | |
<filter-name>springEncoding</filter-name> | |
<url-pattern>/*</url-pattern> | |
</filter-mapping> | |
<!-- 配置OpenSessionInView(一定要在struts2之前) --> | |
<filter> | |
<filter-name>openSessionInView</filter-name> | |
<filter-class> | |
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter | |
</filter-class> | |
</filter> | |
<filter-mapping> | |
<filter-name>openSessionInView</filter-name> | |
<url-pattern>/*</url-pattern> | |
</filter-mapping> | |
<!-- struts2 --> | |
<filter> | |
<filter-name>Struts2</filter-name> | |
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> | |
</filter> | |
<filter-mapping> | |
<filter-name>Struts2</filter-name> | |
<url-pattern>/*</url-pattern> | |
</filter-mapping> | |
<!-- Spring容器 (监听器)--> | |
<listener> | |
<listener-class> | |
org.springframework.web.context.ContextLoaderListener | |
</listener-class> | |
</listener> | |
<context-param> | |
<param-name>contextConfigLocation</param-name> | |
<param-value> | |
classpath:applicationContext*.xml | |
</param-value> | |
</context-param> | |
<welcome-file-list> | |
<welcome-file>index.jsp</welcome-file> | |
</welcome-file-list> | |
</web-app> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment