beyondj-data-loader-jpa-spring-config.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <beans
  2. xmlns:tx="http://www.springframework.org/schema/tx"
  3. xmlns="http://www.springframework.org/schema/beans"
  4. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5. xmlns:jpa="http://www.springframework.org/schema/data/jpa"
  6. xmlns:context="http://www.springframework.org/schema/context"
  7. xmlns:aop="http://www.springframework.org/schema/aop"
  8. xsi:schemaLocation="http://www.springframework.org/schema/beans
  9. http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
  10. http://www.springframework.org/schema/tx
  11. http://www.springframework.org/schema/tx/spring-tx-4.1.xsd
  12. http://www.springframework.org/schema/data/jpa
  13. http://www.springframework.org/schema/data/jpa/spring-jpa-1.0.xsd
  14. http://www.springframework.org/schema/aop
  15. http://www.springframework.org/schema/aop/spring-aop-4.1.xsd
  16. http://www.springframework.org/schema/context
  17. http://www.springframework.org/schema/context/spring-context-4.1.xsd">
  18. <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
  19. <property name="locations">
  20. <list>
  21. <value>classpath:config.properties</value>
  22. </list>
  23. </property>
  24. </bean>
  25. <context:component-scan base-package="com.techempower.beyondj"/>
  26. <jpa:repositories base-package="com.techempower.beyondj"></jpa:repositories>
  27. <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
  28. <aop:aspectj-autoproxy proxy-target-class="true" expose-proxy="true"/>
  29. <bean id="sessionFactory"
  30. class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
  31. <property name="dataSource" ref="dataSource"/>
  32. <property name="configLocation" value="classpath:hibernate.cfg.xml"/>
  33. </bean>
  34. <bean id="configProperties"
  35. class="org.springframework.beans.factory.config.PropertiesFactoryBean">
  36. <property name="ignoreResourceNotFound" value="true"/>
  37. <property name="locations">
  38. <list>
  39. <value>classpath:config.properties</value>
  40. </list>
  41. </property>
  42. </bean>
  43. <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
  44. <property name="dataSource" ref="dataSource"/>
  45. </bean>
  46. <!-- <bean id="WorldDataSet" class="com.techempower.beyondj.dataset.WorldDataSet"/>
  47. -->
  48. <bean id="jpaDialect" class="org.springframework.orm.jpa.vendor.HibernateJpaDialect"/>
  49. <bean id="jpaVendorAdapter"
  50. class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
  51. <property name="database" value="${system.jdbc.database.platform}"/>
  52. <property name="databasePlatform" value="${system.jdbc.dialect}"/>
  53. </bean>
  54. <bean id="entityManagerFactory"
  55. class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
  56. <property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml"/>
  57. <property name="persistenceUnitName" value="beyondj_persistence_unit"/>
  58. <property name="dataSource" ref="dataSource"/>
  59. <property name="jpaVendorAdapter" ref="jpaVendorAdapter"/>
  60. <property name="jpaDialect" ref="jpaDialect"/>
  61. </bean>
  62. <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
  63. <property name="entityManagerFactory" ref="entityManagerFactory"/>
  64. </bean>
  65. <bean id="dataSource"
  66. class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  67. <property name="driverClassName" value="${system.jdbc.driver}"/>
  68. <property name="url" value="${system.jdbc.url}"/>
  69. <property name="username" value="${system.jdbc.username}"/>
  70. <property name="password" value="${system.jdbc.password}"/>
  71. </bean>
  72. <bean id="fortuneRepository" class="com.techempower.beyondj.repository.FortuneRepository">
  73. <property name="sessionFactory" ref="sessionFactory"/>
  74. </bean>
  75. <bean id="worldRepositoryImpl" class="com.techempower.beyondj.repository.WorldRepository">
  76. <property name="sessionFactory" ref="sessionFactory"/>
  77. </bean>
  78. </beans>