Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="UTF-8"?>
- <beans 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:mvc="http://www.springframework.org/schema/mvc"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context.xsd
- http://www.springframework.org/schema/mvc
- http://www.springframework.org/schema/mvc/spring-mvc.xsd
- http://www.springframework.org/schema/tx
- http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">
- <!-- Add support for component scanning -->
- <context:component-scan base-package="com.spring.crm"/>
- <!-- Add support for conversion, formatting and validation support -->
- <mvc:annotation-driven/>
- <mvc:resources mapping="/resources/**" location="/resources/"/>
- <bean
- class="org.springframework.web.servlet.view.InternalResourceViewResolver">
- <property name="prefix" value="/WEB-INF/view/"/>
- <property name="suffix" value=".jsp"/>
- </bean>
- <bean id="myDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
- <property name="driverClass" value="com.mysql.cj.jdbc.Driver"/>
- <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/crm_hibernate?useSSL=false&serverTimezone=Europe/Warsaw"/>
- <property name="user" value="hbstudent"/>
- <property name="password" value="hbstudent"/>
- </bean>
- <bean name="jpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />
- <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
- <property name="persistenceUnitName" value="JPAUnit"/>
- <property name="dataSource" ref="myDataSource"/>
- <property name="packagesToScan" value="com.spring.crm.model"/>
- <property name="jpaVendorAdapter" ref="jpaVendorAdapter"/>
- <property name="jpaProperties">
- <props>
- <prop key="hibernate.dialect">org.hibernate.dialect.MySQL8Dialect</prop>
- <prop key="hibernate.show_sql">true</prop>
- </props>
- </property>
- </bean>
- <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
- <bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>
- <bean id="myTransactionManager"
- class="org.springframework.orm.jpa.JpaTransactionManager">
- <property name="entityManagerFactory" ref="entityManagerFactory"/>
- </bean>
- <!-- Step 4: Enable configuration of transactional behavior based on annotations -->
- <tx:annotation-driven transaction-manager="myTransactionManager"/>
- </beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement