I use aop and mvc:annotation-driven ,only oauth2 ,'app/oauth/authorize ' can be used.When i delete mvc:annotation-driven ,aop can be used.
Any help?
I use aop and mvc:annotation-driven ,only oauth2 ,'app/oauth/authorize ' can be used.When i delete mvc:annotation-driven ,aop can be used.
Any help?
I'm not sure there is enough detail to understand the symptoms of the problem you have. Can you provide some more details of what goes wrong and some config snippets (please use [code][/code] tags).
My config.
Spring-security.xml
Spring-web.xmlCode:<?xml version="1.0" encoding="UTF-8"?> <b:beans ***> <http entry-point-ref="authenticationProcessingFilterEntryPoint" realm="cups" > <intercept-url pattern="/photos" access="ROLE_USER,SCOPE_TRUST" /> <intercept-url pattern="/photos/**" access="ROLE_USER,SCOPE_TRUST" /> <intercept-url pattern="/trusted/**" access="ROLE_CLIENT,SCOPE_TRUST" /> <intercept-url pattern="/user/**" access="ROLE_USER,SCOPE_TRUST" /> <intercept-url pattern="/**/*.css" access="IS_AUTHENTICATED_ANONYMOUSLY" /> <intercept-url pattern="/messagebroker/amf" access="IS_AUTHENTICATED_ANONYMOUSLY" /> <intercept-url pattern="/login.jsp*" access="IS_AUTHENTICATED_ANONYMOUSLY" /> <intercept-url pattern="/login.jsp" access="IS_AUTHENTICATED_ANONYMOUSLY" /> <intercept-url pattern="/oauth2/authorize" access="IS_AUTHENTICATED_ANONYMOUSLY" /> <intercept-url pattern="/oauth2/**" access="IS_AUTHENTICATED_ANONYMOUSLY" /> <intercept-url pattern="/**" access="ROLE_USER,SCOPE_TRUST" /> <logout delete-cookies="false" invalidate-session="true" logout-success-url="/login.jsp" logout-url="/logout.do" /> <session-management invalid-session-url="/views/process/default.jsp" session-authentication-error-url="/login.jsp" > <concurrency-control max-sessions="10" error-if-maximum-exceeded="true" /> </session-management> <custom-filter ref="validateCodeAuthenticationFilter" position="FORM_LOGIN_FILTER" /> <custom-filter ref="resourceServerFilter" before="EXCEPTION_TRANSLATION_FILTER" /> --> <custom-filter ref="myFilter" before="FILTER_SECURITY_INTERCEPTOR" /> </http> <b:bean id="authenticationProcessingFilterEntryPoint" class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint"> <b:property name="loginFormUrl" value="/login.jsp" /> </b:bean> <b:bean id="validateCodeAuthenticationFilter" class="com.cups.process.core.filter.ValidateCodeUsernamePasswordAuthenticationFilter"> <b:constructor-arg ref="dataSource" /> <b:property name="filterProcessesUrl" value="/login.do"></b:property> <b:property name="authenticationSuccessHandler" ref="loginLogAuthenticationSuccessHandler"></b:property> <b:property name="authenticationFailureHandler" ref="simpleUrlAuthenticationFailureHandler"></b:property> <b:property name="authenticationManager" ref="authenticationManager"></b:property> </b:bean> <b:bean id="loginLogAuthenticationSuccessHandler" class="org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler"> <b:property name="defaultTargetUrl" value="/views/process/default.jsp"></b:property>< </b:bean> <b:bean id="simpleUrlAuthenticationFailureHandler" class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler"> <b:property name="defaultFailureUrl" value="/login.jsp"></b:property> </b:bean> <b:bean id="myFilter" class="com.cups.process.core.security.FilterSecurityInterceptorImpl"> <b:property name="authenticationManager" ref="authenticationManager" /> <b:property name="accessDecisionManager" ref="myAccessDecisionManager" /> <b:property name="securityMetadataSource" ref="mySecurityMetadataSource" /> </b:bean> <b:bean id="myAccessDecisionManager" class="com.cups.process.core.security.AccessDecisionManagerImpl"> </b:bean> <b:bean id="mySecurityMetadataSource" class="com.cups.process.core.security.InvocationSecurityMetadataSourceServiceImpl"> </b:bean> <b:bean id="userDetailsManager" class="com.cups.process.core.security.UserDetailsServiceImpl"> <b:property name="userCache" ref="userCache" /> </b:bean> <b:bean id="clientDetails" class="org.springframework.security.oauth2.provider.JdbcClientDetailsService"> <b:constructor-arg ref="dataSource"/> </b:bean> <authentication-manager alias="authenticationManager"> <authentication-provider user-service-ref="userDetailsManager"> <password-encoder hash="md5" > <salt-source user-property="username"/> </password-encoder> </authentication-provider> </authentication-manager> <b:bean id="photoServices" class="com.cups.business.web.integration.oauth2.service.impl.PhotoServiceImpl"> <b:property name="photos"> <b:list> <b:bean class="com.cups.business.web.integration.oauth2.model.PhotoInfo"> <b:property name="id" value="5" /> <b:property name="name" value="photo5.jpg" /> <b:property name="userId" value="admin1" /> <b:property name="resourceURL" value="/com/cups/business/web/integration/oauth2/resources/photo5.jpg" /> </b:bean> </b:list> </b:property> </b:bean> </b:beans>
web.xmlCode:<?xml version="1.0" encoding="UTF-8"?> <beans *****" default-lazy-init="true"> <description>SPRING MVC</description> <mvc:annotation-driven /> <mvc:default-servlet-handler /> <context:annotation-config /> <context:component-scan base-package="com.cups" /> <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" /> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="/views/" p:suffix=".jsp" /> <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver" p:defaultEncoding="utf-8" /> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="views/" /> <property name="suffix" value=".jsp" /> </bean> <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"> <property name="basename" value="messages" /> </bean> <bean id="doubleSubmitInterceptor" class="com.cups.process.core.interceptor.RepeatSubmitInterceptor"> <property name="mappingURL" value=".*method=saveForm\w*|.*method=saveSimpleForm\w*|.*method=submitSimpleForm\w*|.*method=submitForm\w*" /> </bean> <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"> <property name="interceptors"> <list> <ref bean="doubleSubmitInterceptor" /> </list> </property> </bean> <bean id="logInterceptor" class="com.cups.process.core.interceptor.LogInterceptor"></bean> <aop:config> <aop:advisor id="logText" advice-ref="logInterceptor" pointcut="execution(* com.cups.testModel.service.*.*(..))" /> </aop:config> <aop:config> <aop:advisor id="biadata" advice-ref="logInterceptor" pointcut="execution(* com.cups.business.web.workbench.bizdata.service.*.*(..))" /> </aop:config> </beans>
Code:<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> <init-param> <param-name>contextAttribute</param-name> <param-value>org.springframework.web.servlet.FrameworkServlet.CONTEXT.spring</param-value> </init-param> </filter> <filter-mapping> <filter-name>springSecurityFilterChain</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <servlet> <servlet-name>spring</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring-web.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <servlet> <servlet-name>CXFServlet</servlet-name> <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>CXFServlet</servlet-name> <url-pattern>/ws/*</url-pattern> </servlet-mapping> <listener> <listener-class>flex.messaging.HttpFlexSession</listener-class> </listener> <servlet> <servlet-name>MessageBrokerServlet</servlet-name> <servlet-class>flex.messaging.MessageBrokerServlet</servlet-class> <init-param> <param-name>services.configuration.file</param-name> <param-value>/WEB-INF/flex/services-config.xml</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> <servlet-mapping> <servlet-name>MessageBrokerServlet</servlet-name> <url-pattern>/messagebroker/*</url-pattern> </servlet-mapping> <session-config > <session-timeout>100</session-timeout> </session-config> <welcome-file-list> <welcome-file>default.jsp</welcome-file> </welcome-file-list> <error-page> <error-code>500</error-code> <location>/views/commons/500.jsp</location> </error-page> </web-app>
I'm still not sure what you are saying the problem is, but there are some issues with your configuration. Here are a few off the top of my head:
* You have 2 ContextLoaderListener instances (not sure what that does), and the web.xml looks invalid because the ordering is wrong. It's possible your container doesn't mind.
* The ContextLoaderListener(s) use(s) the default config location which is applicationContext.xml and you haven't showed that file. Maybe it is doing something that explains all teh confusion?
* The springSecurityFilterChain is going to look for a bean in the servlet context, which you haven't defined in the code you posted.
* You only mapped *.do to the Spring Servlet. That's not going to work for the OAuth endpoints.
* The OAuth endpoints are not defined in your servlet context (explcitly, although I suspect there are some things you haven't shown).
* I can't see a definition of the resourceServerFilter bean anywhere
None of this has anything to do with aop or mvc namespaces, but it's hard to get past the obvious errors to look for something more subtle.
this is my all config.
web.xml
applicationContext.xmlCode:<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>cups</display-name> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> <init-param> <param-name>contextAttribute</param-name> <param-value>org.springframework.web.servlet.FrameworkServlet.CONTEXT.spring</param-value> </init-param> </filter> <filter-mapping> <filter-name>springSecurityFilterChain</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <servlet> <servlet-name>spring</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring-web.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!-- Web Service--> <servlet> <servlet-name>CXFServlet</servlet-name> <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <!-- CXFServlet Mapping --> <servlet-mapping> <servlet-name>CXFServlet</servlet-name> <url-pattern>/ws/*</url-pattern> </servlet-mapping> <!-- Flex config start... --> <!-- Http Flex Session attribute and binding listener support --> <listener> <listener-class>flex.messaging.HttpFlexSession</listener-class> </listener> <!-- MessageBroker Servlet --> <servlet> <servlet-name>MessageBrokerServlet</servlet-name> <servlet-class>flex.messaging.MessageBrokerServlet</servlet-class> <init-param> <param-name>services.configuration.file</param-name> <param-value>/WEB-INF/flex/services-config.xml</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> <servlet-mapping> <servlet-name>MessageBrokerServlet</servlet-name> <url-pattern>/messagebroker/*</url-pattern> </servlet-mapping> <!-- Flex config end!!! --> <session-config > <session-timeout>100</session-timeout> </session-config> <welcome-file-list> <welcome-file>default.jsp</welcome-file> </welcome-file-list> <error-page> <error-code>500</error-code> <location>/views/commons/500.jsp</location> </error-page> </web-app>
spring-security.xmlCode:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd" default-lazy-init="true"> <description>SPRING CONFIG</description> <import resource="classpath:spring-service.xml" /> <import resource="classpath:spring-cache.xml" /> <import resource="classpath:spring-dao.xml" /> <import resource="classpath:spring-security.xml" /> <!-- --> <import resource="classpath:spring-ws.xml" /> <import resource="classpath:spring-mail.xml" /> <import resource="classpath:META-INF/workflow.xml" /> </beans>
Code:<?xml version="1.0" encoding="UTF-8"?> <b:beans xmlns="http://www.springframework.org/schema/security" xmlns:b="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oauth="http://www.springframework.org/schema/security/oauth2" xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-1.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd "> <http entry-point-ref="authenticationProcessingFilterEntryPoint" realm="cups" > <intercept-url pattern="/photos" access="ROLE_USER" /> <intercept-url pattern="/photos/**" access="ROLE_USER" /> <intercept-url pattern="/trusted/**" access="ROLE_CLIENT" /> <intercept-url pattern="/user/**" access="ROLE_USER" /> <intercept-url pattern="/**/*.jpg" access="IS_AUTHENTICATED_ANONYMOUSLY" /> <intercept-url pattern="/messagebroker/amf" access="IS_AUTHENTICATED_ANONYMOUSLY" /> <intercept-url pattern="/login.jsp*" access="IS_AUTHENTICATED_ANONYMOUSLY" /> <intercept-url pattern="/login.jsp" access="IS_AUTHENTICATED_ANONYMOUSLY" /> <intercept-url pattern="/oauth2/authorize" access="IS_AUTHENTICATED_ANONYMOUSLY" /> <intercept-url pattern="/oauth2/**" access="IS_AUTHENTICATED_ANONYMOUSLY" /> <intercept-url pattern="/**" access="ROLE_USER" /> <logout delete-cookies="false" invalidate-session="true" logout-success-url="/login.jsp" logout-url="/logout.do" /> <session-management invalid-session-url="/views/process/default.jsp" session-authentication-error-url="/login.jsp" > <concurrency-control max-sessions="10" error-if-maximum-exceeded="true" /> </session-management> <custom-filter ref="validateCodeAuthenticationFilter" position="FORM_LOGIN_FILTER" /> <custom-filter ref="resourceServerFilter" before="EXCEPTION_TRANSLATION_FILTER" /> <custom-filter ref="myFilter" before="FILTER_SECURITY_INTERCEPTOR" /> </http> <b:bean id="authenticationProcessingFilterEntryPoint" class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint"> <b:property name="loginFormUrl" value="/login.jsp" /> </b:bean> <b:bean id="validateCodeAuthenticationFilter" class="com.cups.process.core.filter.ValidateCodeUsernamePasswordAuthenticationFilter"> <b:constructor-arg ref="dataSource" /> <b:property name="filterProcessesUrl" value="/login.do"></b:property <b:property name="authenticationSuccessHandler" ref="loginLogAuthenticationSuccessHandler"></b:property> <b:property name="authenticationFailureHandler" ref="simpleUrlAuthenticationFailureHandler"></b:property> <b:property name="authenticationManager" ref="authenticationManager"></b:property> </b:bean> <b:bean id="loginLogAuthenticationSuccessHandler" class="org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler"> <b:property name="defaultTargetUrl" value="/views/process/default.jsp"></b:property </b:bean> <b:bean id="simpleUrlAuthenticationFailureHandler" class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler"> <b:property name="defaultFailureUrl" value="/login.jsp"></b:property> </b:bean> <b:bean id="myFilter" class="com.cups.process.core.security.FilterSecurityInterceptorImpl"> <b:property name="authenticationManager" ref="authenticationManager" /> <b:property name="accessDecisionManager" ref="myAccessDecisionManager" /> <b:property name="securityMetadataSource" ref="mySecurityMetadataSource" /> </b:bean> <b:bean id="myAccessDecisionManager" class="com.cups.process.core.security.AccessDecisionManagerImpl"> </b:bean> <b:bean id="mySecurityMetadataSource" class="com.cups.process.core.security.InvocationSecurityMetadataSourceServiceImpl"> </b:bean> <b:bean id="userDetailsManager" class="com.cups.process.core.security.UserDetailsServiceImpl"> <b:property name="userCache" ref="userCache" /> </b:bean> <b:bean id="clientDetails" class="org.springframework.security.oauth2.provider.JdbcClientDetailsService"> <b:constructor-arg ref="dataSource"/> </b:bean> <authentication-manager alias="authenticationManager"> <authentication-provider user-service-ref="userDetailsManager"> <password-encoder hash="md5" > <salt-source user-property="username"/> </password-encoder> </authentication-provider> </authentication-manager> <b:bean id="photoServices" class="com.cups.business.web.integration.oauth2.service.impl.PhotoServiceImpl"> <b:property name="photos"> <b:list><b:bean class="com.cups.business.web.integration.oauth2.model.PhotoInfo"> <b:property name="id" value="6" /> <b:property name="name" value="photo6.jpg" /> <b:property name="userId" value="admin" /> <b:property name="resourceURL" value="/com/cups/business/web/integration/oauth2/resources/photo6.jpg" /> </b:bean> </b:list> </b:property> </b:bean> <b:bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"> <b:property name="basename" value="classpath:messages_zh_CN"></b:property> </b:bean> </b:beans>
spring-service.xml
Code:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd" default-lazy-init="true"> <description>service bean</description> <bean id="processDesignerService" class="com.cups.process.web.service.manager.processes.impl.ProcessDefineDesignerService"></bean> <bean id="processOperationDesignerService" class="com.cups.process.web.service.manager.processes.impl.ProcessOperationDesignerService"></bean> <bean id="bizCatalogDesignerService" class="com.cups.process.web.service.manager.processes.impl.BizCatalogDesignerService"></bean> <bean id="processInstDesignerService" class="com.cups.process.web.service.manager.processes.impl.ProcessInstDesignerService"> </bean> <bean id="passwordEncoder" class="org.springframework.security.authentication.encoding.Md5PasswordEncoder" /> <bean id="wfOrganizationService" class="com.cups.process.web.service.organization.api.OrganiaztionQueryService" /> <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" /> </beans>
spring-web.xml
spring-ws.xmlCode:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd" default-lazy-init="true"> <description>SPRING MVC</description> <mvc:annotation-driven /> <mvc:default-servlet-handler /> <context:annotation-config /> <context:component-scan base-package="com.cups" /> <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" /> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="/views/" p:suffix=".jsp" /> <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver" p:defaultEncoding="utf-8" /> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="views/" /> <property name="suffix" value=".jsp" /> </bean> <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"> <property name="basename" value="messages" /> </bean> <bean id="doubleSubmitInterceptor" class="com.cups.process.core.interceptor.RepeatSubmitInterceptor"> <property name="mappingURL" value=".*method=saveForm\w*|.*method=saveSimpleForm\w*|.*method=submitSimpleForm\w*|.*method=submitForm\w*" /> </bean> <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"> <property name="interceptors"> <list> <ref bean="doubleSubmitInterceptor" /> </list> </property> </bean> <bean id="testLicenseBean" class="com.cups.process.core.license.ValidateLicense" init-method="init"> </bean> <bean id="logInterceptor" class="com.cups.process.core.interceptor.LogInterceptor"></bean> <aop:config> <aop:advisor id="logText" advice-ref="logInterceptor" pointcut="execution(* com.cups.testModel.service.*.*(..))" /> </aop:config> <aop:config> <aop:advisor id="biadata" advice-ref="logInterceptor" pointcut="execution(* com.cups.business.web.workbench.bizdata.service.*.*(..))" /> </aop:config> <aop:config> <aop:advisor id="workitem" advice-ref="logInterceptor" pointcut="execution(* com.cups.business.web.workbench.workitem.service.*.*(..))" /> </aop:config> <aop:config> <aop:advisor id="catalog" advice-ref="logInterceptor" pointcut="execution(* com.cups.process.web.service.manager.catalog.*.*(..))" /> </aop:config> </beans>
Code:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> <!-- Import Apache CXF Bean Definition --> <import resource="classpath:META-INF/cxf/cxf.xml" /> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> <jaxws:endpoint id="processService" implementorClass="com.cups.process.web.webservice.workflow.ProcessService" address="/processService"> </jaxws:endpoint> </beans>
spring-cache.xml
Code:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd"> <bean id="userCache" class="org.springframework.security.core.userdetails.cache.EhCacheBasedUserCache"> <property name="cache" ref="userEhCache" /> </bean> <bean id="userEhCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean"> <property name="cacheName" value="userCache" /> <property name="cacheManager" ref="cacheManager" /> </bean> <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" /> </beans>
spring-dao.xml
Code:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd" default-lazy-init="true"> <description>DAO CONFIG</description> <context:annotation-config /> <context:component-scan base-package="com.cups" /> <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close"> <property name="url" value="jdbc:mysql://127.0.0.1:3306/cups?useUnicode=true&characterEncoding=UTF-8" /> <property name="username" value="root" /> <property name="password" value="root" /> <property name="initialSize" value="1" /> <property name="maxActive" value="200" /> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect" >org.hibernate.dialect.MySQLDialect</prop> </props> </property> <property name="packagesToScan"> <list> <value>com.cups.testModel</value> <value>com.cups.business.web.model</value> <value>com.cups.process.web.model</value> <value>com.cups.process.core.mvc.model</value> <value>com.cups.business.web.support.schedule.model</value> <value>com.cups.business.web.support.menu.model</value> <value>com.cups.business.web.support.resource.model</value> <value>com.cups.business.web.support.dict.model</value> <value>com.cups.business.web.workbench.bizdata.model</value> <value>com.cups.business.web.workbench.agent.model</value> <value>com.cups.business.web.integration.oauth2.model</value> <value>com.cups.business.web.attachment.manager.model</value> </list> </property> </bean> <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate" > <property name="dataSource" ref="dataSource" /> </bean> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> <property name="dataSource" ref="dataSource" /> </bean> <bean id="SpringTransactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource"> <ref bean="dataSource"/> </property> </bean> <bean id="genericHibernateDAO" class="com.cups.process.core.mvc.dao.impl.GenericDAO"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean class="com.cups.process.core.common.primarykey.SequenceFactory" init-method="init"> <property name="uniqueTableApp"> <bean class="com.cups.process.core.common.primarykey.impl.CUPSDefaultUniqueTableApp"> <constructor-arg index="0" ref="dataSource" /> </bean> </property> </bean> <tx:annotation-driven transaction-manager="transactionManager" /> </beans>
spring-mail.xml
Code:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd" default-lazy-init="true"> <description>SPRING MAIL</description> <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"> <property name="host"> <value>smtp.163.com</value> </property> <property name="javaMailProperties"> <props> <prop key="mail.smtp.auth">true</prop> </props> </property> <property name="username"> <value>cupsMail</value> </property> <property name="password"> <value>cupsmail123</value> </property> </bean> </beans>