Java Spring Framework
-
මේ Error එක එනව main claas eke එකෙ "ApplicationContext context = new ClassPathXmlApplicationContext("applicationContextFile.xml");" line එකෙන්
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator#0' defined in class path resource [applicationContextFile.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator]
applicationContextFile.xml
<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.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"> <bean id="opBean" class="aspectdeclaresasaspect.Operation"></bean> <bean id="trackMyBean" class="aspectdeclaresasaspect.TrackOperation"></bean> <bean class="org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator"></bean> </beans>
main class "Test.java"
public class Test {
public static void main(String[] args) { // TODO Auto-generated method stub ApplicationContext context = new ClassPathXmlApplicationContext("applicationContextFile.xml"); Operation o = (Operation) context.getBean("opBean"); System.out.println("Calling msg....."); o.msg(); System.out.println("Calling m....."); o.m(); System.out.println("Calling k....."); o.k(); }
}