AOP is not work in Spring MVC framework
Hi,
I try to use the AOP in my Spring MVC framework. Is there anyone can tell me why? The Codes as below:
web.xml
...
<servlet>
<servlet-name>springshare</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/springshare-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springshare</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
...
<listener>
<listener-class>org.springframework.web.context.ContextLoade rListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext.xml
</param-value>
</context-param>
...
springshare-servlet.xml
<context:component-scan base-package="com.chalet.springshare" ></context:component-scan>
<mvc:annotation-driven />
applicationContext.xml
<aop:aspectj-autoproxy/>
@Component
@Aspect
public class PreGreetingMethods {
Logger logger = Logger.getLogger(PreGreetingMethods.class);
@Before("execution(* com.chalet.springshare.service.AOPService+.*(..))" )
public void beforeInterfaceAndCTest(){
logger.info(">>>>>>>>>PreGreetingMethods.beforeInt erfaceAndCTest executed!");
}
}
When I call the method in the class AOPServiceImpl which implements the interface AOPService, the log mentioned above is not printed.