Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <beans>
- <context:property-placeholder properties-ref="deployProperties"/>
- <!-- Activates various annotations to be detected in bean classes -->
- <context:annotation-config/>
- <!--I need this for all packages to be scanned -->
- <!-- check for duplicates: DONE -->
- <context:component-scan base-package="com.davidoladeji.epx">
- <context:include-filter type="aspectj"
- expression="com.davidoladeji.epx.log.LoggableAdvice" />
- </context:component-scan>
- <!-- Configures the annotation-driven Spring MVC Controller programming model.
- Note that, with Spring 3.0, this tag works in Servlet MVC only! -->
- <mvc:annotation-driven/>
- <mvc:resources mapping="/resources/**" location="/resources/"/>
- <!-- Imports logging configuration -->
- <import resource="tracers-context.xml"/>
- <!-- Imports datasource configuration -->
- <import resource="spring-data.xml"/>
- <bean id="deployProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean"
- p:location="/WEB-INF/spring.properties"/>
- <!--<bean id="encoder" class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder"></bean>-->
- <bean>
- <context:component-scan base-package="com.davidoladeji.epx"/>
- <mvc:annotation-driven/>
- <mvc:resources mapping="/css/**" location="resources/assets/css/"/>
- <mvc:resources mapping="/images/**" location="resources/assets/images/"/>
- <mvc:resources mapping="/js/**" location="resources/assets/js/"/>
- <mvc:resources mapping="/fonts/**" location="resources/assets/fonts/"/>
- <mvc:resources mapping="/img/**" location="resources/assets/img/"/>
- <mvc:resources mapping="/prettify/**" location="resources/assets/prettify/"/>
- <mvc:resources mapping="/ajax/**" location="resources/assets/ajax/"/>
- <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
- <property name="prefix" value="/WEB-INF/views/"/>
- <property name="suffix" value=".jsp"/>
- </bean>
- <!--<bean id="loggingAspect" class="com.davidoladeji.epx.log.LoggableAdvice"/>
- <bean class="com.davidoladeji.epx.service.LoggableService"/>-->
- <bean id="messageSource"
- class="org.springframework.context.support.ResourceBundleMessageSource">
- <property name="basename" value="messages"/>
- </bean>
- Spring-data.xml
- <beans>
- <context:property-placeholder properties-ref="deployProperties"/>
- <tx:annotation-driven transaction-manager="transactionManager"/>
- <!-- Activate Spring Data JPA repository support -->
- <jpa:repositories base-package="com.davidoladeji.epx.repository"/>
- <!-- Declare a datasource that has pooling capabilities-->
- <bean id="jpaDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
- destroy-method="close"
- p:driverClass="${app.jdbc.driverClassName}"
- p:jdbcUrl="${app.jdbc.url}"
- p:user="${app.jdbc.username}"
- p:password="${app.jdbc.password}"
- p:acquireIncrement="5"
- p:idleConnectionTestPeriod="60"
- p:maxPoolSize="100"
- p:maxStatements="50"
- p:minPoolSize="10"/>
- <!-- Declare a JPA entityManagerFactory -->
- <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
- p:persistenceXmlLocation="classpath*:META-INF/persistence.xml"
- p:persistenceUnitName="hibernatePersistenceUnit"
- p:dataSource-ref="jpaDataSource"
- p:jpaVendorAdapter-ref="hibernateVendor"/>
- <!-- Specify ORM vendor -->
- <bean id="hibernateVendor" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
- p:showSql="false"/>
- <!-- Declare a transaction manager-->
- <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"
- p:entityManagerFactory-ref="entityManagerFactory"/>
- </beans>
- web.xml
- <web-app>
- <display-name>Spring MVC Application</display-name>
- <filter>
- <filter-name>springSecurityFilterChain</filter-name>
- <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
- </filter>
- <filter-mapping>
- <filter-name>springSecurityFilterChain</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
- <!--
- <context-param>
- <param-name>javax.servlet.jsp.jstl.fmt.fallbackLocale</param-name>
- <param-value>en</param-value>
- </context-param>-->
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>
- /WEB-INF/spring-security.xml
- /WEB-INF/applicationContext.xml
- </param-value>
- </context-param>
- <listener>
- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
- </listener>
- <servlet>
- <servlet-name>mvc-dispatcher</servlet-name>
- <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>mvc-dispatcher</servlet-name>
- <url-pattern>/</url-pattern>
- </servlet-mapping>
- <error-page>
- <error-code>404</error-code>
- <location>/WEB-INF/views/404.jsp</location>
- </error-page>
- </web-app>
- <beans>
- <bean id="customizableTraceInterceptor" class="com.davidoladeji.epx.model.itools.Tracer"
- p:enterMessage="Entering $[targetClassShortName].$[methodName]($[arguments])"
- p:exitMessage="Leaving $[targetClassShortName].$[methodName](): $[returnValue]"/>
- <aop:aspectj-autoproxy/>
- <tx:annotation-driven transaction-manager="transactionManager"/>
- <tx:advice id="txAdvice" transaction-manager="transactionManager">
- <tx:attributes>
- <!-- e.g. getUserRoles in LoginService-->
- <tx:method name="get*" read-only="true"/>
- <tx:method name="find*" read-only="true"/>
- <tx:method name="add*" propagation="REQUIRED"/>
- <tx:method name="save*" propagation="REQUIRED"/>
- <tx:method name="*"/>
- </tx:attributes>
- </tx:advice>
- <aop:config>
- <aop:pointcut id="userServicePointCut"
- expression="execution(* com.davidoladeji.epx.service.*Service.*(..))"/>
- <!--Where should the advice be applied all files ending with Service-->
- <aop:advisor advice-ref="txAdvice" pointcut-ref="userServicePointCut"/>
- </aop:config>
- </beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement