spring-config.xml 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xmlns:jaxws="http://cxf.apache.org/jaxws"
  5. xmlns:jaxrs="http://cxf.apache.org/jaxrs"
  6. xmlns:cxf="http://cxf.apache.org/core"
  7. xmlns:util="http://www.springframework.org/schema/util"
  8. xmlns:context="http://www.springframework.org/schema/context"
  9. xmlns:tx="http://www.springframework.org/schema/tx"
  10. xmlns:task="http://www.springframework.org/schema/task"
  11. xsi:schemaLocation="http://www.springframework.org/schema/beans
  12. http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
  13. http://www.springframework.org/schema/context
  14. http://www.springframework.org/schema/context/spring-context-4.1.xsd
  15. http://www.springframework.org/schema/tx
  16. http://www.springframework.org/schema/tx/spring-tx-4.1.xsd
  17. http://www.springframework.org/schema/task
  18. http://www.springframework.org/schema/task/spring-task-4.1.xsd
  19. http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
  20. http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
  21. http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
  22. http://www.springframework.org/schema/aop
  23. http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
  24. http://www.springframework.org/schema/util
  25. http://www.springframework.org/schema/util/spring-util-3.0.xsd
  26. ">
  27. <context:property-placeholder location="classpath:system.properties" />
  28. <import resource="druid.xml"/>
  29. <import resource="spring-redis.xml"/>
  30. <import resource="classpath:META-INF/cxf/cxf.xml" />
  31. <jaxws:endpoint id="userService"
  32. implementor="org.cs.webservice.impl.UserServiceImpl"
  33. address="/userWS">
  34. </jaxws:endpoint>
  35. <!-- 支持异步方法执行 -->
  36. <task:annotation-driven />
  37. <bean id="sessionFactory"
  38. class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
  39. <property name="dataSource" ref="dataSource"></property>
  40. <property name="packagesToScan">
  41. <list>
  42. <value>org.cs.core</value>
  43. <value>org.cs.mgr</value>
  44. <value>org.cs.web</value>
  45. <value>org.cs.ws</value>
  46. <value>org.cs.notify</value>
  47. </list>
  48. </property>
  49. <property name="hibernateProperties">
  50. <props>
  51. <prop key="hibernate.show_sql">true</prop>
  52. <prop key="hibernate.format_sql">true</prop>
  53. <prop key="hibernate.hbm2ddl.auto">update</prop> <!-- none validate -->
  54. <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
  55. </props>
  56. </property>
  57. <property name="entityInterceptor">
  58. <bean id="entityInterceptor" class="org.cs.core.interceptor.EntityInterceptor" />
  59. </property>
  60. </bean>
  61. <!-- 配置事务管理 -->
  62. <bean id="transactionManager"
  63. class="org.springframework.orm.hibernate4.HibernateTransactionManager">
  64. <property name="sessionFactory" ref="sessionFactory" />
  65. </bean>
  66. <!-- 配置注解实现管理事务(cglib:proxy-target-class="true") -->
  67. <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" />
  68. <bean id="hibernateTemplate" class="org.springframework.orm.hibernate4.HibernateTemplate">
  69. <property name="sessionFactory" ref="sessionFactory"></property>
  70. </bean>
  71. <bean id="jdbcTemplate" class="org.cs.core.dao.impl.MyJdbcTemplate">
  72. <property name="dataSource" ref="dataSource"></property>
  73. </bean>
  74. <!-- 使用 annotation -->
  75. <context:annotation-config />
  76. <context:component-scan base-package="org.cs" >
  77. <!-- <context:exclude-filter type="annotation" -->
  78. <!-- expression="org.springframework.stereotype.Controller" /> -->
  79. </context:component-scan>
  80. <bean id="springContextHolder" class="org.cs.core.util.SpringUtil" />
  81. <!-- 当Spring容器启动完成后执行下面的这个Bean -->
  82. <bean class="org.cs.core.util.DataSourceInitListener" />
  83. </beans>