123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- <?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 http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"
- xmlns:aop="http://www.springframework.org/schema/aop">
- <!--业务Beans, 使用注解方式配置-->
- <context:component-scan base-package="com.yihu.hos">
- </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.71:3306/esb?useUnicode=true&characterEncoding=UTF-8"/>
- <property name="username" value="hos"/>
- <property name="password" value="hos"/>
- <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="packagesToScan">
- <list>
- <!-- 可以加多个包 -->
- <value>com.yihu.hos.standard.model</value>
- </list>
- </property>
- <property name="hibernateProperties">
- <value>
- hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
- hibernate.show_sql=false
- hibernate.format_sql=true
- </value>
- </property>
- <property name="mappingLocations">
- <list>
- <!-- <value>classpath:hbm/*.hbm.xml</value>-->
- <value>classpath:resource/*.hbm.xml</value>
- </list>
- </property>
- </bean>
- <!-- 将多个配置文件读取到容器中,交给Spring管理 -->
- <!--Hibernate 事务配置-->
- <bean id="txManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
- <property name="sessionFactory" ref="sessionFactory"/>
- </bean>
- <tx:annotation-driven transaction-manager="txManager" proxy-target-class="true"/>
- <!--文件上传支持-->
- <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>
- <!--<bean id="quartzScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean" scope="singleton">-->
- <!--<property name="dataSource" ref="dataSource"/>-->
- <!--<property name="configLocation" value="classpath:/config/quartz.properties" />-->
- <!--<property name="autoStartup" value="true"/>-->
- <!--</bean>-->
- </beans>
|