Advertisement
mrchebik

servletContext

Nov 17th, 2016
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.76 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:p="http://www.springframework.org/schema/p"
  6.        xmlns:jpa="http://www.springframework.org/schema/data/jpa"
  7.        xmlns:tx="http://www.springframework.org/schema/tx"
  8.        xmlns:mvc="http://www.springframework.org/schema/mvc"
  9.        xsi:schemaLocation="http://www.springframework.org/schema/mvc
  10.    http://www.springframework.org/schema/mvc/spring-mvc.xsd
  11.    http://www.springframework.org/schema/tx
  12.    http://www.springframework.org/schema/tx/spring-tx.xsd
  13.    http://www.springframework.org/schema/beans
  14.    http://www.springframework.org/schema/beans/spring-beans.xsd
  15.    http://www.springframework.org/schema/context
  16.    http://www.springframework.org/schema/context/spring-context.xsd
  17.    http://www.springframework.org/schema/data/jpa
  18.    http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">
  19.  
  20.     <tx:annotation-driven transaction-manager="transactionManager"/>
  21.  
  22.     <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
  23.         <property name="entityManagerFactory" ref="emf"/>
  24.     </bean>
  25.  
  26.     <bean id="emf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
  27.         <property name="dataSource" ref="dataSource" />
  28.         <property name="jpaVendorAdapter">
  29.             <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" >
  30.                 <property name="showSql" value="true" />
  31.                 <property name="databasePlatform" value="org.hibernate.dialect.MySQLDialect" />
  32.             </bean>
  33.         </property>
  34.         <property name="packagesToScan" value="ru.mrchebik.model"/>
  35.     </bean>
  36.  
  37.     <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  38.         <property name="driverClassName" value="com.mysql.jdbc.Driver" />
  39.         <property name="url" value="jdbc:mysql://localhost:3306/NotesWeb?useUnicode=true&amp;characterEncoding=UTF-8&amp;characterSetResults=UTF-8" />
  40.         <property name="username" value="root" />
  41.         <property name="password" value="root" />
  42.     </bean>
  43.  
  44.     <mvc:annotation-driven />
  45.  
  46.     <jpa:repositories base-package="ru.mrchebik.repository" entity-manager-factory-ref="emf" transaction-manager-ref="transactionManager"/>
  47.  
  48.     <context:component-scan base-package="ru.mrchebik.service.impl" />
  49.  
  50.     <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"
  51.           p:prefix="/WEB-INF/views/"
  52.           p:suffix=".jsp"/>
  53.  
  54.     <mvc:resources mapping="/resources/**" location="/resources/" />
  55.  
  56. </beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement