123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- <?xml version="1.0" encoding="UTF-8"?>
- <beans default-lazy-init="false"
- 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:tx="http://www.springframework.org/schema/tx"
- xmlns:util="http://www.springframework.org/schema/util"
- xmlns:mvc="http://www.springframework.org/schema/mvc"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
- http://www.springframework.org/schema/tx
- http://www.springframework.org/schema/tx/spring-tx.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context.xsd
- http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
- http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"
- >
- <!--业务Beans, 使用注解方式配置-->
- <context:component-scan base-package="com.yihu">
- <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
- </context:component-scan>
- <!--====================返回为null的时候转“”==========================-->
- <mvc:annotation-driven>
- <mvc:message-converters register-defaults="true">
- <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
- <property name="objectMapper">
- <bean class="com.fasterxml.jackson.databind.ObjectMapper">
- <property name="serializationInclusion">
- <value type="com.fasterxml.jackson.annotation.JsonInclude.Include">NON_NULL</value>
- </property>
- </bean>
- </property>
- </bean>
- </mvc:message-converters>
- </mvc:annotation-driven>
- <!--Hibernate 数据库配置-->
- <bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
- <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
- <!--
- <property name="url"
- value="jdbc:mysql://172.19.103.50:3306/healtharchive?useUnicode=true&characterEncoding=UTF-8"/>
- <property name="username" value="fujian"/>
- <property name="password" value="fujian"/>
- -->
- <property name="url"
- value="jdbc:mysql://192.168.1.220:3306/hos2_resource?useUnicode=true&characterEncoding=UTF-8"/>
- <property name="username" value="hos2"/>
- <property name="password" value="hos2"/>
- <property name="initialSize" value="1"/>
- <property name="maxTotal" value="100"/>
- <property name="maxIdle" value="50"/>
- <property name="minIdle" value="20"/>
- <property name="validationQuery" value="SELECT 1"/>
- <property name="testOnBorrow" value="true"/>
- <property name="removeAbandonedTimeout" value="55"/>
- </bean>
- <!--Hibernate 会话管理器配置-->
- <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
- <property name="dataSource" ref="dataSource"/>
- <property name="hibernateProperties">
- <value>
- hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
- hibernate.show_sql=true
- hibernate.format_sql=true
- </value>
- </property>
- <property name="mappingLocations">
- <list>
- <!-- <value>classpath:hbm/*.hbm.xml</value>-->
- <value>classpath:hbm/resource/*.hbm.xml</value>
- </list>
- </property>
- </bean>
- <!-- 将多个配置文件读取到容器中,交给Spring管理 -->
- <util:properties id="propertyConfigurer" location="classpath:/resource.properties"/>
- <!--Hibernate 事务配置-->
- <bean id="txManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
- <property name="sessionFactory" ref="sessionFactory"/>
- </bean>
- <tx:annotation-driven transaction-manager="txManager"/>
- <!--Redis 连接池配置-->
- <bean id="poolConfig" class="redis.clients.jedis.JedisPoolConfig">
- <property name="maxTotal" value="15"/>
- <property name="maxIdle" value="10"/>
- <property name="minIdle" value="5"/>
- </bean>
- <!--Redis 数据库配置-->
- <bean id="jedisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
- <!--property name="hostName" value="172.17.110.68" note="use this element when deploy on tomcat in real"/-->
- <property name="hostName" value="192.168.1.220"/>
- <property name="port" value="6379"/>
- <property name="poolConfig" ref="poolConfig"/>
- </bean>
- <!--Redis 会话管理器配置-->
- <bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate">
- <property name="connectionFactory" ref="jedisConnectionFactory"/>
- </bean>
- <bean class="org.springframework.beans.factory.config.CustomEditorConfigurer">
- <property name="customEditors">
- <map>
- <entry key="com.yihu.ehr.framework.constrant.JobType"
- value="com.yihu.ehr.framework.util.web.JobTypeConverter"/>
- </map>
- </property>
- </bean>
- <!--文件上传支持-->
- <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"/>
- <!--国际化配置-->
- <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
- <description>Message Sources</description>
- <property name="basenames">
- <list>
- <value>text/message</value>
- </list>
- </property>
- <property name="defaultEncoding" value="UTF-8"/>
- </bean>
- <bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
- <property name="cookieMaxAge" value="604800"/>
- <property name="defaultLocale" value="zh_CN"/>
- <property name="cookieName" value="Language"></property>
- </bean>
- <bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"/>
- <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
- <property name="dataSource" ref="dataSource"/>
- </bean>
- <!--Hibernate模版配置 -->
- <bean id="hibernateTemplate" class="org.springframework.orm.hibernate4.HibernateTemplate">
- <property name="sessionFactory" ref="sessionFactory"></property>
- </bean>
- </beans>
|