Advertisement
Guest User

Untitled

a guest
Dec 5th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  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:context="http://www.springframework.org/schema/context"
  5. xmlns:tx="http://www.springframework.org/schema/tx"
  6. xmlns:mvc="http://www.springframework.org/schema/mvc"
  7. xsi:schemaLocation="http://www.springframework.org/schema/beans
  8. http://www.springframework.org/schema/beans/spring-beans.xsd
  9. http://www.springframework.org/schema/context
  10. http://www.springframework.org/schema/context/spring-context.xsd
  11. http://www.springframework.org/schema/mvc
  12. http://www.springframework.org/schema/mvc/spring-mvc.xsd
  13. http://www.springframework.org/schema/tx
  14. http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">
  15.  
  16. <!-- Add support for component scanning -->
  17. <context:component-scan base-package="com.spring.crm"/>
  18.  
  19. <!-- Add support for conversion, formatting and validation support -->
  20. <mvc:annotation-driven/>
  21. <mvc:resources mapping="/resources/**" location="/resources/"/>
  22.  
  23. <bean
  24. class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  25. <property name="prefix" value="/WEB-INF/view/"/>
  26. <property name="suffix" value=".jsp"/>
  27. </bean>
  28.  
  29. <bean id="myDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
  30. <property name="driverClass" value="com.mysql.cj.jdbc.Driver"/>
  31. <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/crm_hibernate?useSSL=false&amp;serverTimezone=Europe/Warsaw"/>
  32. <property name="user" value="hbstudent"/>
  33. <property name="password" value="hbstudent"/>
  34. </bean>
  35.  
  36. <bean name="jpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />
  37.  
  38. <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
  39. <property name="persistenceUnitName" value="JPAUnit"/>
  40. <property name="dataSource" ref="myDataSource"/>
  41. <property name="packagesToScan" value="com.spring.crm.model"/>
  42. <property name="jpaVendorAdapter" ref="jpaVendorAdapter"/>
  43. <property name="jpaProperties">
  44. <props>
  45. <prop key="hibernate.dialect">org.hibernate.dialect.MySQL8Dialect</prop>
  46. <prop key="hibernate.show_sql">true</prop>
  47. </props>
  48. </property>
  49. </bean>
  50.  
  51. <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
  52. <bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>
  53.  
  54. <bean id="myTransactionManager"
  55. class="org.springframework.orm.jpa.JpaTransactionManager">
  56. <property name="entityManagerFactory" ref="entityManagerFactory"/>
  57. </bean>
  58.  
  59. <!-- Step 4: Enable configuration of transactional behavior based on annotations -->
  60. <tx:annotation-driven transaction-manager="myTransactionManager"/>
  61.  
  62. </beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement