81,094
社区成员
发帖
与我相关
我的任务
分享
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property name="LOG_HOME" value="D:/xxx_logs"/>
<appender name="STOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %level [%thread] [%file : %line] - %msg%n</pattern>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>${LOG_HOME}/run.log</File>
<encoder>
<pattern>%d{HH:mm:ss.SSS} %level [%thread] [%file : %line] - %msg%n</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_HOME}/run-%d{yyyyMMdd}.%i.zip</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 100MB -->
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!-- keep 30 days' worth of history -->
<maxHistory>30</maxHistory>
</rollingPolicy>
</appender>
<logger name="org.hibernate.engine.internal.StatisticalLoggingSessionEventListener" level="off"/>
<root level="error">
<appender-ref ref="STOUT"/>
<appender-ref ref="FILE"/>
</root>
</configuration>
<?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:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:xcf="http://www.xmcares.com/schema/framework"
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/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd" profile="">
<!--配置数据源-->
<!--<context:property-placeholder location="classpath:dbconfig.properties" />-->
<bean id="propertyConfigurer" class="com.xxxxxx.framework.database.DBPropertiesCrypter">
<property name="location" value="classpath:dbconfig.properties"/>
</bean>
<xxx:annotation-driven id="xxx-xxxx" dataSource-ref="dataSource"
entityManagerFactory-ref="entityManagerFactory"
message-basenames="classpath:i18n/message"/>
<xxx:serviceful-driven />
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
<property name="initialSize" value="10"/>
<property name="minIdle" value="10"/>
<property name="maxIdle" value="200"/>
</bean>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan"
value="com.xxxxx.xxxxxx" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />
</property>
<property name="jpaProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<!-- 默认数据库用户-->
<prop key="hibernate.default_schema">${schema.app}</prop>
<!-- 开启二级缓存 -->
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<!-- 启动"查询缓存"如果想缓存使用findall()、list()、Iterator()、createCriteria()、createQuery()等方法获得的数据结果集,必须配置此项-->
<prop key="hibernate.cache.use_query_cache">true</prop>
<!-- 二级缓存区域名的前缀 -->
<!--<prop name="hibernate.cache.region_prefix">test</prop>-->
<!-- 高速缓存提供程序(Hibernate4以后都封装到org.hibernate.cache.ehcache.EhCacheRegionFactory ) -->
<prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</prop>
<!-- 指定缓存配置文件位置 -->
<!-- <prop name="hibernate.cache.provider_configuration_file_resource_path">
ehcache.xml
</prop> -->
<!-- 强制Hibernate以更人性化的格式将数据存入二级缓存 -->
<prop key="hibernate.cache.use_structured_entries">true</prop>
<!-- Hibernate将收集有助于性能调节的统计数据 -->
<prop key="hibernate.generate_statistics">true</prop>
<prop key="hibernate.ejb.interceptor">com.xxxxx.framework.database.EntityInterceptor</prop>
</props>
</property>
</bean>
<!--事务-->
<bean id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager"
p:entityManagerFactory-ref="entityManagerFactory" />
<jpa:repositories base-package="com.xxxxx.xxxxxx"
transaction-manager-ref="transactionManager" entity-manager-factory-ref="entityManagerFactory"/>
</beans>
jdbc.driverClassName=oracle.jdbc.driver.OracleDriver
hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
hibernate.show_sql=true