Advertisement
Guest User

Untitled

a guest
Apr 5th, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 3.15 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:mvc="http://www.springframework.org/schema/mvc"
  5.    xmlns:context="http://www.springframework.org/schema/context"
  6.    xmlns:aop="http://www.springframework.org/schema/aop"
  7.    xmlns:tx="http://www.springframework.org/schema/tx"
  8.     xsi:schemaLocation="
  9.     http://www.springframework.org/schema/beans    
  10.     http://www.springframework.org/schema/beans/spring-beans.xsd
  11.     http://www.springframework.org/schema/context
  12.    http://www.springframework.org/schema/context/spring-context.xsd
  13.    http://www.springframework.org/schema/mvc
  14.    http://www.springframework.org/schema/mvc/spring-mvc.xsd
  15.    http://www.springframework.org/schema/aop
  16.    http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
  17.    http://www.springframework.org/schema/tx
  18.    http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
  19.    
  20.     <!-- Use @Component annotations for bean definitions -->
  21.     <context:component-scan base-package="com.movietime" />
  22.    
  23.     <!-- Use @Controller annotations for MVC controller definitions -->
  24.     <mvc:annotation-driven enable-matrix-variables="true"/>
  25.    
  26.     <!-- View resolver -->
  27.     <bean class=
  28.         "org.springframework.web.servlet.view.InternalResourceViewResolver">
  29.       <property name="prefix" value="/WEB-INF/"/>
  30.       <property name="suffix" value=".jsp" />
  31.     </bean>
  32.  
  33.     <!-- Defining the dataSource -->
  34.     <bean id="dataSource" name="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  35.         <property name="driverClassName" value="com.mysql.jdbc.Driver" />
  36.         <property name="url" value="jdbc:mysql://localhost:3306/movietime2" />
  37.         <property name="username" value="root" />
  38.         <property name="password" value="root" />
  39.     </bean>
  40.      
  41.     <!-- Necessary to get the entity manager injected into the factory bean -->
  42.     <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
  43.      
  44.      <!-- Define EclipseLink JPA Vendor Adapter -->
  45.     <bean id="jpaVendorAdapter"
  46.         class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
  47.         <property name="databasePlatform"
  48.             value="org.eclipse.persistence.platform.database.MySQLPlatform" />
  49.         <property name="generateDdl" value="false" />
  50.         <property name="showSql" value="true" />
  51.     </bean>
  52.      
  53.      
  54.     <!-- Setting up JPA Entity Manager Factory -->
  55.     <bean id="entityManagerFactory"
  56.        class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" >
  57.         <property name="packagesToScan" value="com.movietime.entities" />
  58.         <property name="persistenceUnitName" value="MovieTime"></property>
  59.         <property name="jpaVendorAdapter" ref="jpaVendorAdapter" />
  60.         <property name="dataSource" ref="dataSource"/>
  61.     </bean>
  62.  
  63.     <!-- Transaction Manager -->
  64.     <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"
  65.        p:entityManagerFactory-ref="entityManagerFactory" />
  66.    
  67.     <!-- Detect @Transactional -->
  68.     <tx:annotation-driven transaction-manager="transactionManager" />
  69.  
  70. </beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement