org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [c

来源:互联网 发布:儿童阅读打卡软件 编辑:程序博客网 时间:2024/06/04 23:29

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'forumService': FactoryBean threw exception on object creation; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class java.lang.String]: Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException: Cannot subclass final class class java.lang.Stringat org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102)at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1443)at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:249)at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1117)at com.dhcc.advice.TestIntroduction.main(TestIntroduction.java:31)Caused by: org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class java.lang.String]: Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException: Cannot subclass final class class java.lang.Stringat org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:217)at org.springframework.aop.framework.ProxyFactoryBean.getProxy(ProxyFactoryBean.java:362)at org.springframework.aop.framework.ProxyFactoryBean.getSingletonInstance(ProxyFactoryBean.java:316)at org.springframework.aop.framework.ProxyFactoryBean.getObject(ProxyFactoryBean.java:242)at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)... 6 moreCaused by: java.lang.IllegalArgumentException: Cannot subclass final class class java.lang.Stringat org.springframework.cglib.proxy.Enhancer.generateClass(Enhancer.java:446)at org.springframework.cglib.transform.TransformingClassGenerator.generateClass(TransformingClassGenerator.java:33)at org.springframework.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)at org.springframework.cglib.proxy.Enhancer.create(Enhancer.java:285)at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:205)... 10 more



这就是 sting   value="forumSrviceTarget"  报错,这里,不能用value要用ref
Could not generate CGLIB subclass of class [class java.lang.String]


<?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 id="pmonitor" class="com.baobaotao.introduce.ControllablePerformaceMonitor" /><bean id="forumServiceTarget" class="com.baobaotao.introduce.ForumService" /><bean id="forumService" class="org.springframework.aop.framework.ProxyFactoryBean"><property name="interfaces" value="com.baobaotao.introduce.Monitorable"></property><!-- <property name="target" value="forumServiceTarget"></property> --><!--    注意这里是ref而不是 value    --><property name="target" value="forumServiceTarget"></property><property name="interceptorNames" value="pmonitor"></property><property name="proxyTargetClass" value="true"></property></bean></beans>


0 0
原创粉丝点击