How is this BeansConfigValidator run? manually/automatically?
Spring IDE does not catch the "badID" I'm using when getting a Bean and also it doesn't spot the invalid class name "BadAdvisor" I use for the Advisor.
What am I missing?
Code:
public class Driver
{
public static void main(String[] args)
{
ApplicationContext ac =
new FileSystemXmlApplicationContext("applicationcontext.xml");
MyBeanInt bean1 = (MyBeanInt) ac.getBean("BadID");
bean1.execute();
bean1.doit();
}
}
***********************
public class MyAdvice implements MethodBeforeAdvice
{
/**
*
*/
public void before(Method method, Object[] args, Object target)
throws Throwable
{
System.out.println(">>>" + method.getName() + "()");
}
}
********************
public class MyBean implements MyBeanInt
{
public void execute()
{
System.out.println("execute doing stuff");
}
public void doit()
{
System.out.println("doit doing stuff");
}
}
*************************
public interface MyBeanInt
{
public abstract void execute();
public abstract void doit();
}
***********************
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<bean id="MyBeanProxyWithMethodMatchingPattern"
class="org.springframework.aop.framework.ProxyFactoryBean" >
<property name="target">
<ref local="MyTarget">
</ref>
</property>
<property name="interceptorNames">
<list>
<value>advisor</value>
</list>
</property>
</bean>
<bean id="MyTarget" class="MyBean" >
</bean>
<bean id="advice" class="MyAdvice" >
</bean>
<bean id="advisor"
class="org.springframework.aop.support.BadAdvisor" >
<property name="advice">
<ref local="advice"/>
</property>
<property name="pointcut">
<bean class="org.springframework.aop.support.JdkRegexpMethodPointcut">
<property name="pattern">
<value>e*</value>
</property>
</bean>
</property>
</bean>
</beans>