我正在学习春天的AOP。目前我正在尝试使用NameMatchMehtodPointCut创建静态点切割。但是 NameMatchMethodPointcutAdvisor与学生
不兼容主要方法:
angular.element($window).bind('resize', function () {
console.log('resize', $window.innerWidth); // I can see change here
$scope.window_width = $window.innnerWidth; // no change here
});
应用程序上下文XML:
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
public class Show {
public static void main(String[] args) {
try{
Resource resource=new ClassPathResource("applicationContext.xml");
BeanFactory beanFactory= new XmlBeanFactory(resource);
/*Basic Spring */
Student std=(Student) beanFactory.getBean("loggingAdvisor");
String p=std.show();
System.out.println(p);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
LoggingAOP.java
<?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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean name="student" class="Student" autowire="byType">
<!-- <constructor-arg name="std_id" value="2212" /> <constructor-arg name="name"
value="Raj" /> -->
<property name="std_id" value="2734"/>
<property name="name" value="Sujit"/>
</bean>
<bean name="address" class="Address">
<!-- <constructor-arg name="street" value="2734" /> <constructor-arg name="city"
value="BBSR" /> <constructor-arg name="zip" value="560100" /> -->
<property name="street" value="2734" />
<property name="city" value="BBSR" />
<property name="zip" value="560100" />
</bean>
<bean name='loggingAOP' class="LoggingAOP"/>
<bean name="AOPDemo" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target" ref="student"/>
<property name="interceptorNames">
<list><value>loggingAOP</value></list>
</property>
</bean>
<bean id="loggingAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
<property name="advice" ref="loggingAOP"></property>
<property name="mappedName"><value>show</value></property>
</bean>
<!-- <bean name="mypointcut" class="org.springframework.aop.support.NameMatchMethodPointcut">
<property name="mappedName"><value>show</value></property>
</bean> -->
</beans>
我有学生和地址的POJO课程。
请帮帮我!!