Advertisement
Guest User

Untitled

a guest
Jun 20th, 2013
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 5.18 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd         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-3.2.xsd         http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.2.xsd         http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd">
  3.     <!--
  4.        This will automatically locate any and all property files you have
  5.        within your classpath, provided they fall under the META-INF/spring
  6.        directory. The located property files are parsed and their values can
  7.        then be used within application context files in the form of
  8.        ${propertyKey}.
  9.    -->
  10.     <context:property-placeholder location="classpath*:META-INF/spring/*.properties"/>
  11.     <!--
  12.        Turn on AspectJ @Configurable support. As a result, any time you
  13.        instantiate an object, Spring will attempt to perform dependency
  14.        injection on that object. This occurs for instantiation via the "new"
  15.        keyword, as well as via reflection. This is possible because AspectJ
  16.        is used to "weave" Roo-based applications at compile time. In effect
  17.        this feature allows dependency injection of any object at all in your
  18.        system, which is a very useful feature (without @Configurable you'd
  19.        only be able to dependency inject objects acquired from Spring or
  20.        subsequently presented to a specific Spring dependency injection
  21.        method). Roo applications use this useful feature in a number of
  22.        areas, such as @PersistenceContext injection into entities.
  23.    -->
  24.     <context:spring-configured/>
  25.     <!--
  26.        This declaration will cause Spring to locate every @Component,
  27.        @Repository and @Service in your application. In practical terms this
  28.        allows you to write a POJO and then simply annotate the new POJO as an
  29.        @Service and Spring will automatically detect, instantiate and
  30.        dependency inject your service at startup time. Importantly, you can
  31.        then also have your new service injected into any other class that
  32.        requires it simply by declaring a field for your service inside the
  33.        relying class and Spring will inject it. Note that two exclude filters
  34.        are declared. The first ensures that Spring doesn't spend time
  35.        introspecting Roo-specific ITD aspects. The second ensures Roo doesn't
  36.        instantiate your @Controller classes, as these should be instantiated
  37.        by a web tier application context. Refer to web.xml for more details
  38.        about the web tier application context setup services.
  39.        
  40.        Furthermore, this turns on @Autowired, @PostConstruct etc support. These
  41.        annotations allow you to use common Spring and Java Enterprise Edition
  42.        annotations in your classes without needing to do any special configuration.
  43.        The most commonly used annotation is @Autowired, which instructs Spring to
  44.        dependency inject an object into your class.
  45.    -->
  46.     <context:component-scan base-package="com.gerrytan">
  47.         <context:exclude-filter expression=".*_Roo_.*" type="regex"/>
  48.         <context:exclude-filter expression="org.springframework.stereotype.Controller" type="annotation"/>
  49.     </context:component-scan>
  50.     <bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="dataSource">
  51.         <property name="driverClassName" value="${database.driverClassName}"/>
  52.         <property name="url" value="${database.url}"/>
  53.         <property name="username" value="${database.username}"/>
  54.         <property name="password" value="${database.password}"/>
  55.         <property name="testOnBorrow" value="true"/>
  56.         <property name="testOnReturn" value="true"/>
  57.         <property name="testWhileIdle" value="true"/>
  58.         <property name="timeBetweenEvictionRunsMillis" value="1800000"/>
  59.         <property name="numTestsPerEvictionRun" value="3"/>
  60.         <property name="minEvictableIdleTimeMillis" value="1800000"/>
  61.         <property name="validationQuery" value="SELECT 1"/>
  62.     </bean>
  63.     <bean class="org.springframework.orm.jpa.JpaTransactionManager" id="transactionManager">
  64.         <property name="entityManagerFactory" ref="entityManagerFactory"/>
  65.     </bean>
  66.     <tx:annotation-driven mode="aspectj" transaction-manager="transactionManager"/>
  67.     <bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="entityManagerFactory">
  68.         <property name="persistenceUnitName" value="persistenceUnit"/>
  69.         <property name="dataSource" ref="dataSource"/>
  70.     </bean>
  71. </beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement