<?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"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<!-- 业务层-->
<bean id="userService" class="com.cwj.Service.UserServiceImpl"/>
<!-- 切面层-->
<bean id="myAscpect" class="com.cwj.Service.MyAspect"/>
<bean id="proxyService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="interfaces" value="com.cwj.Service.UserService"/>
<property name="target" ref="userService"/>
<property name="interceptorNames" value="proxyService"/>
<!--使用cglib创建代理 -->
<property name="optimize" value="true"></property>
</bean>
</beans>
五月 10, 2019 12:15:19 上午 org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh
信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@66cd51c3: startup date [Fri May 10 00:15:19 CST 2019]; root of context hierarchy
五月 10, 2019 12:15:19 上午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [com/cwj/beans3.xml]
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.springframework.beans.factory.BeanCreationException
```at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:185)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1640)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:254)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1080)
at com.cwj.Text.Text4.main(Text4.java:28)
public class Text4 {
public static void main(String[] args) {
ApplicationContext context=new ClassPathXmlApplicationContext("com/cwj/beans3.xml");
UserService service= (UserService) context.getBean("proxyService");
service.addUser();
service.deletUser();
}
}
来个大佬看看,这个错误第二次了,第一次的时候我发现了是jar包的版本太低,导入版本的Jar包,问题解决了,现在又出现了这个问题,求大佬帮忙