Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.25 KB | None | 0 0
  1. <beans>
  2. <context:property-placeholder properties-ref="deployProperties"/>
  3.  
  4.  
  5. <!-- Activates various annotations to be detected in bean classes -->
  6. <context:annotation-config/>
  7.  
  8. <!--I need this for all packages to be scanned -->
  9. <!-- check for duplicates: DONE -->
  10. <context:component-scan base-package="com.davidoladeji.epx">
  11. <context:include-filter type="aspectj"
  12. expression="com.davidoladeji.epx.log.LoggableAdvice" />
  13. </context:component-scan>
  14.  
  15. <!-- Configures the annotation-driven Spring MVC Controller programming model.
  16. Note that, with Spring 3.0, this tag works in Servlet MVC only! -->
  17. <mvc:annotation-driven/>
  18.  
  19. <mvc:resources mapping="/resources/**" location="/resources/"/>
  20.  
  21. <!-- Imports logging configuration -->
  22. <import resource="tracers-context.xml"/>
  23.  
  24. <!-- Imports datasource configuration -->
  25. <import resource="spring-data.xml"/>
  26.  
  27. <bean id="deployProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean"
  28. p:location="/WEB-INF/spring.properties"/>
  29.  
  30.  
  31. <!--<bean id="encoder" class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder"></bean>-->
  32.  
  33. <bean>
  34. <context:component-scan base-package="com.davidoladeji.epx"/>
  35.  
  36. <mvc:annotation-driven/>
  37.  
  38. <mvc:resources mapping="/css/**" location="resources/assets/css/"/>
  39. <mvc:resources mapping="/images/**" location="resources/assets/images/"/>
  40. <mvc:resources mapping="/js/**" location="resources/assets/js/"/>
  41. <mvc:resources mapping="/fonts/**" location="resources/assets/fonts/"/>
  42. <mvc:resources mapping="/img/**" location="resources/assets/img/"/>
  43. <mvc:resources mapping="/prettify/**" location="resources/assets/prettify/"/>
  44. <mvc:resources mapping="/ajax/**" location="resources/assets/ajax/"/>
  45.  
  46. <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  47. <property name="prefix" value="/WEB-INF/views/"/>
  48. <property name="suffix" value=".jsp"/>
  49. </bean>
  50.  
  51. <!--<bean id="loggingAspect" class="com.davidoladeji.epx.log.LoggableAdvice"/>
  52. <bean class="com.davidoladeji.epx.service.LoggableService"/>-->
  53.  
  54. <bean id="messageSource"
  55. class="org.springframework.context.support.ResourceBundleMessageSource">
  56. <property name="basename" value="messages"/>
  57. </bean>
  58.  
  59. Spring-data.xml
  60. <beans>
  61.  
  62. <context:property-placeholder properties-ref="deployProperties"/>
  63.  
  64. <tx:annotation-driven transaction-manager="transactionManager"/>
  65.  
  66. <!-- Activate Spring Data JPA repository support -->
  67. <jpa:repositories base-package="com.davidoladeji.epx.repository"/>
  68.  
  69. <!-- Declare a datasource that has pooling capabilities-->
  70. <bean id="jpaDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
  71. destroy-method="close"
  72. p:driverClass="${app.jdbc.driverClassName}"
  73. p:jdbcUrl="${app.jdbc.url}"
  74. p:user="${app.jdbc.username}"
  75. p:password="${app.jdbc.password}"
  76. p:acquireIncrement="5"
  77. p:idleConnectionTestPeriod="60"
  78. p:maxPoolSize="100"
  79. p:maxStatements="50"
  80. p:minPoolSize="10"/>
  81.  
  82.  
  83. <!-- Declare a JPA entityManagerFactory -->
  84. <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
  85. p:persistenceXmlLocation="classpath*:META-INF/persistence.xml"
  86. p:persistenceUnitName="hibernatePersistenceUnit"
  87. p:dataSource-ref="jpaDataSource"
  88. p:jpaVendorAdapter-ref="hibernateVendor"/>
  89.  
  90. <!-- Specify ORM vendor -->
  91. <bean id="hibernateVendor" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
  92. p:showSql="false"/>
  93.  
  94. <!-- Declare a transaction manager-->
  95. <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"
  96. p:entityManagerFactory-ref="entityManagerFactory"/>
  97.  
  98. </beans>
  99.  
  100. web.xml
  101.  
  102.  
  103. <web-app>
  104.  
  105. <display-name>Spring MVC Application</display-name>
  106. <filter>
  107. <filter-name>springSecurityFilterChain</filter-name>
  108. <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
  109. </filter>
  110. <filter-mapping>
  111. <filter-name>springSecurityFilterChain</filter-name>
  112. <url-pattern>/*</url-pattern>
  113. </filter-mapping>
  114. <!--
  115. <context-param>
  116. <param-name>javax.servlet.jsp.jstl.fmt.fallbackLocale</param-name>
  117. <param-value>en</param-value>
  118. </context-param>-->
  119.  
  120. <context-param>
  121. <param-name>contextConfigLocation</param-name>
  122. <param-value>
  123. /WEB-INF/spring-security.xml
  124. /WEB-INF/applicationContext.xml
  125. </param-value>
  126. </context-param>
  127.  
  128.  
  129. <listener>
  130. <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  131. </listener>
  132.  
  133. <servlet>
  134. <servlet-name>mvc-dispatcher</servlet-name>
  135. <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  136. <load-on-startup>1</load-on-startup>
  137. </servlet>
  138.  
  139. <servlet-mapping>
  140. <servlet-name>mvc-dispatcher</servlet-name>
  141. <url-pattern>/</url-pattern>
  142. </servlet-mapping>
  143.  
  144. <error-page>
  145. <error-code>404</error-code>
  146. <location>/WEB-INF/views/404.jsp</location>
  147. </error-page>
  148.  
  149. </web-app>
  150.  
  151. <beans>
  152.  
  153. <bean id="customizableTraceInterceptor" class="com.davidoladeji.epx.model.itools.Tracer"
  154. p:enterMessage="Entering $[targetClassShortName].$[methodName]($[arguments])"
  155. p:exitMessage="Leaving $[targetClassShortName].$[methodName](): $[returnValue]"/>
  156.  
  157.  
  158. <aop:aspectj-autoproxy/>
  159.  
  160.  
  161. <tx:annotation-driven transaction-manager="transactionManager"/>
  162. <tx:advice id="txAdvice" transaction-manager="transactionManager">
  163. <tx:attributes>
  164. <!-- e.g. getUserRoles in LoginService-->
  165. <tx:method name="get*" read-only="true"/>
  166. <tx:method name="find*" read-only="true"/>
  167. <tx:method name="add*" propagation="REQUIRED"/>
  168. <tx:method name="save*" propagation="REQUIRED"/>
  169. <tx:method name="*"/>
  170. </tx:attributes>
  171. </tx:advice>
  172.  
  173.  
  174. <aop:config>
  175. <aop:pointcut id="userServicePointCut"
  176. expression="execution(* com.davidoladeji.epx.service.*Service.*(..))"/>
  177.  
  178. <!--Where should the advice be applied all files ending with Service-->
  179. <aop:advisor advice-ref="txAdvice" pointcut-ref="userServicePointCut"/>
  180. </aop:config>
  181.  
  182.  
  183. </beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement