Advertisement
Guest User

Untitled

a guest
Sep 17th, 2017
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.45 KB | None | 0 0
  1. <beans xmlns="http://www.springframework.org/schema/beans"
  2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xmlns:p="http://www.springframework.org/schema/p"
  4. xmlns:context="http://www.springframework.org/schema/context"
  5. xmlns:jdbc="http://www.springframework.org/schema/jdbc"
  6. xmlns:tx="http://www.springframework.org/schema/tx"
  7. xmlns:jpa="http://www.springframework.org/schema/data/jpa"
  8. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  9. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
  10. http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
  11. http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
  12. http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">
  13.  
  14. <beans profile="h2,postgres">
  15. <jdbc:initialize-database data-source="dataSource" enabled="${database.init}">
  16. <jdbc:script location="classpath:db/${jdbc.initLocation}"/>
  17. <jdbc:script encoding="utf-8" location="classpath:db/data.sql"/>
  18. </jdbc:initialize-database>
  19.  
  20. <tx:annotation-driven/>
  21.  
  22. <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
  23. p:dataSource-ref="dataSource"
  24. p:packagesToScan="arkhipov.bank">
  25.  
  26. <property name="jpaVendorAdapter">
  27. <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
  28. p:databasePlatform="${jpa.databasePlatform}"
  29. p:showSql="${jpa.showSql}">
  30. </bean>
  31. </property>
  32. </bean>
  33.  
  34. <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"
  35. p:entityManagerFactory-ref="entityManagerFactory"/>
  36.  
  37. <context:component-scan base-package="arkhipov.bank.repositories"/>
  38.  
  39. <jpa:repositories base-package="arkhipov.bank.repositories" entity-manager-factory-ref="entityManagerFactory"
  40. transaction-manager-ref="transactionManager"/>
  41. </beans>
  42.  
  43. <beans profile="h2">
  44. <context:property-placeholder location="classpath:db/h2.properties" system-properties-mode="OVERRIDE"/>
  45.  
  46. <bean id="dataSource"
  47. class="org.springframework.jdbc.datasource.DriverManagerDataSource"
  48. p:driverClassName="org.h2.Driver"
  49. p:url="${database.url}"
  50. p:username="${database.username}"
  51. p:password="${database.password}"/>
  52. </beans>
  53.  
  54. <beans profile="postgres">
  55. <context:property-placeholder location="classpath:db/postgres.properties" system-properties-mode="OVERRIDE"/>
  56.  
  57. <bean id="dataSource"
  58. class="org.springframework.jdbc.datasource.DriverManagerDataSource"
  59. p:driverClassName="org.postgresql.Driver"
  60. p:url="${database.url}"
  61. p:username="${database.username}"
  62. p:password="${database.password}"/>
  63. </beans>
  64. </beans>
  65.  
  66. <beans xmlns="http://www.springframework.org/schema/beans"
  67. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  68. xmlns:p="http://www.springframework.org/schema/p"
  69. xmlns:context="http://www.springframework.org/schema/context"
  70. xmlns:jdbc="http://www.springframework.org/schema/jdbc"
  71. xmlns:tx="http://www.springframework.org/schema/tx"
  72. xmlns:jpa="http://www.springframework.org/schema/data/jpa"
  73. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  74. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
  75. http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
  76. http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
  77. http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">
  78.  
  79. <!--<beans profile="h2,postgres">-->
  80. <jdbc:initialize-database data-source="dataSource" enabled="${database.init}">
  81. <jdbc:script location="classpath:db/${jdbc.initLocation}"/>
  82. <jdbc:script encoding="utf-8" location="classpath:db/data.sql"/>
  83. </jdbc:initialize-database>
  84.  
  85. <tx:annotation-driven/>
  86.  
  87. <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
  88. p:dataSource-ref="dataSource"
  89. p:packagesToScan="arkhipov.bank">
  90.  
  91. <property name="jpaVendorAdapter">
  92. <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
  93. p:databasePlatform="${jpa.databasePlatform}"
  94. p:showSql="${jpa.showSql}">
  95. </bean>
  96. </property>
  97. </bean>
  98.  
  99. <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"
  100. p:entityManagerFactory-ref="entityManagerFactory"/>
  101.  
  102. <context:component-scan base-package="arkhipov.bank.repositories"/>
  103.  
  104. <jpa:repositories base-package="arkhipov.bank.repositories" entity-manager-factory-ref="entityManagerFactory"
  105. transaction-manager-ref="transactionManager"/>
  106. <!--</beans>-->
  107.  
  108. <!--<beans profile="h2">-->
  109. <!--<context:property-placeholder location="classpath:db/h2.properties" system-properties-mode="OVERRIDE"/>-->
  110.  
  111. <!--<bean id="dataSource"-->
  112. <!--class="org.springframework.jdbc.datasource.DriverManagerDataSource"-->
  113. <!--p:driverClassName="org.h2.Driver"-->
  114. <!--p:url="${database.url}"-->
  115. <!--p:username="${database.username}"-->
  116. <!--p:password="${database.password}"/>-->
  117. <!--</beans>-->
  118.  
  119. <!--<beans profile="postgres">-->
  120. <context:property-placeholder location="classpath:db/postgres.properties" system-properties-mode="OVERRIDE"/>
  121.  
  122. <bean id="dataSource"
  123. class="org.springframework.jdbc.datasource.DriverManagerDataSource"
  124. p:driverClassName="org.postgresql.Driver"
  125. p:url="${database.url}"
  126. p:username="${database.username}"
  127. p:password="${database.password}"/>
  128. <!--</beans>-->
  129. </beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement