Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- To change this license header, choose License Headers in Project Properties.
- To change this template file, choose Tools | Templates
- and open the template in the editor.
- -->
- <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:jpa="http://www.springframework.org/schema/data/jpa"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
- http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">
- <jpa:repositories base-package="com.test.repo" /><!--scans the query class and registers for future use-->
- <bean id="entityManager" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
- <property name="dataSource" ref="dataSource" />
- <property name="packagesToScan" value="com.test.model" /><!--scans model/entity/domain(name 3 but same) and registers-->
- <property name="jpaVendorAdapter">
- <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />
- </property>
- <property name="jpaProperties">
- <props>
- <prop key="hibernate.hbm2ddl.auto">none</prop><!--automatically creates
- db table from entity for first run.there are drop-create and none options too -->
- <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop><!--uses this dialect to cantact database-->
- <!--prop key="hibernate.hbm2ddl.import_files">populate.sql</prop-->
- <!--you can populate table with data if you want some-->
- <prop key="hibernate.show_sql">true</prop>
- <prop key="hibernate.connection.characterEncoding">UTF-8</prop>
- <prop key="hibernate.connection.useUnicode">true</prop>
- </props>
- </property>
- </bean>
- <bean id="dataSource"
- class="org.springframework.jdbc.datasource.DriverManagerDataSource">
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://localhost:3306/inventoryMgmt"/>
- <property name="username" value="root" />
- <property name="password" value="root" />
- </bean>
- <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
- <property name="entityManagerFactory" ref="entityManager" />
- </bean>
- <!-- Scan for transaction-based resources -->
- <context:component-scan base-package="com.test.model" />
- <context:component-scan base-package="com.test.controller" />
- <context:component-scan base-package="com.test.repo"/>
- <context:component-scan base-package="com.test.service"/>
- <context:component-scan base-package="com.test.serviceImpl"/>
- <tx:annotation-driven transaction-manager="transactionManager"/>
- <bean id="persistenceExceptionTranslationPostProcessor"
- class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>
- <bean id="multipartResolver"
- class="org.springframework.web.multipart.commons.CommonsMultipartResolver"/>
- </beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement