2016-05-16 87 views
0

這個問題是關於Spring中的Java配置。是否有可能在Java代碼中替換下面的聲明。Spring中使用AOP配置Java的配置

<servlet> 
    <servlet-name>Spring MVC Dispatcher Servlet</servlet-name> 
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
    <init-param> 
     <param-name>contextConfigLocation</param-name> 
     <param-value> 
      /WEB-INF/secure-app-context.xml 
     </param-value> 
    </init-param> 
    <load-on-startup>1</load-on-startup> 
</servlet> 

哪裏安全-APP-context.xml中

<beans xmlns="http://www.springframework.org/schema/beans" 
    ... 
    http://www.springframework.org/schema/aop/spring-aop-3.1.xsd"> 

    <aop:aspectj-autoproxy /> 

    <mvc:annotation-driven> 
     <mvc:message-converters register-defaults="false"> 
     <bean class="org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter" /> 
    <bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" /> 
      </mvc:message-converters> 
     </mvc:annotation-driven> 

     <context:component-scan base-package="com.abc.secure.service" /> 

     <bean id="securityAspect" class="com.abc.secure.service.Secure" /> 
    </beans> 
+0

yes是可以在J中替換下面的聲明AVA代碼。 –

回答