最近学习spring,照着网上的文章自己动手练习,看了很多文章还是没有办法解决
applicationContext.xml<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans SYSTEM "spring-beans.dtd">
<beans>
<bean id="BeforeAdvice" class="com.kedacom.spring.aop.BeforeAdvice"></bean>
<bean id="AfterAdvice" class="com.kedacom.spring.aop.AfterAdvice"></bean>
<bean id="CompareInterceptor" class="com.kedacom.spring.aop.CompareInterceptor"></bean>
<bean id="StudentTagget" class="com.kedacom.spring.aop.StudentImpl"></bean>
<bean id="Student" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces">
<value>
com.kedacom.spring.aop.Student
</value>
</property>
<property name="Interceptornames">
<list>
<value>BeforeAdvice</value>
<value>AfterAdvice</value>
<value>CompareInterceptor</value>
</list>
</property>
<property name="Target">
<ref bean="studenttarget"/>
</property>
</bean>
</beans>
错误信息:log4j:WARN No appenders could be found for logger (org.springframework.beans.factory.xml.XmlBeanDefinitionReader).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'Student' defined in file [F:\myeclipse workspace\Spring_Aop\src\applicationContext.xml]: Can't resolve reference to bean 'studenttarget' while setting property 'Target'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'studenttarget' is defined: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [BeforeAdvice,AfterAdvice,CompareInterceptor,StudentTagget,Student]; root of BeanFactory hierarchy
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'studenttarget' is defined: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [BeforeAdvice,AfterAdvice,CompareInterceptor,StudentTagget,Student]; root of BeanFactory hierarchy
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:351)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:640)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:176)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:105)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:916)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:727)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:336)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:271)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:312)
at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:82)
at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:67)
at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:58)
at com.kedacom.spring.aop.Test.main(Test.java:10)
applicationContext.xml<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans SYSTEM "spring-beans.dtd">
<beans>
<bean id="BeforeAdvice" class="com.kedacom.spring.aop.BeforeAdvice"></bean>
<bean id="AfterAdvice" class="com.kedacom.spring.aop.AfterAdvice"></bean>
<bean id="CompareInterceptor" class="com.kedacom.spring.aop.CompareInterceptor"></bean>
<bean id="StudentTagget" class="com.kedacom.spring.aop.StudentImpl"></bean>
<bean id="Student" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces">
<value>
com.kedacom.spring.aop.Student
</value>
</property>
<property name="Interceptornames">
<list>
<value>BeforeAdvice</value>
<value>AfterAdvice</value>
<value>CompareInterceptor</value>
</list>
</property>
<property name="Target">
<ref bean="studenttarget"/>
</property>
</bean>
</beans>
错误信息:log4j:WARN No appenders could be found for logger (org.springframework.beans.factory.xml.XmlBeanDefinitionReader).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'Student' defined in file [F:\myeclipse workspace\Spring_Aop\src\applicationContext.xml]: Can't resolve reference to bean 'studenttarget' while setting property 'Target'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'studenttarget' is defined: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [BeforeAdvice,AfterAdvice,CompareInterceptor,StudentTagget,Student]; root of BeanFactory hierarchy
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'studenttarget' is defined: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [BeforeAdvice,AfterAdvice,CompareInterceptor,StudentTagget,Student]; root of BeanFactory hierarchy
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:351)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:640)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:176)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:105)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:916)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:727)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:336)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:271)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:312)
at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:82)
at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:67)
at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:58)
at com.kedacom.spring.aop.Test.main(Test.java:10)
解决方案 »
- ssh做上传文件功能
- 请教一个批量打印的问题?
- struts2的标签问题
- jboss启动报Could not find main class,是什么原因?
- 对连接池的概念不是很清楚。。。希望大家指教一下
- Lomboz是什么?
- 求一份WebLogic的配置详细说明。
- 请问这个功能该如何实现?
- 请问:为什么parseFloat("2914389.5626") - parseFloat("512582.28")结果是小数点后一大串?
- 本地 获取webShere的JNDI数据库连接 需要那些IBM JAR? 代码如下
- spring最简单的问题,sessionFactory无法注入
- Struts2 中DTO如何使用
在 WEB-INF/lib 目录下
bean id="StudentTagget"大小写啊大小写
bean id="StudentTagget"大小写啊大小写
asm-all.jar,
cglib-nodep.jar,
common-collecttions.jar,
common-dbcp.jar,
common-long.jar,
common-loging.jar,
common-poor.jar,
log4j.jar,
jta.jar,
spring.jar
<ref bean="studenttarget"/>
</property>你确定你改了?
<!DOCTYPE beans SYSTEM "spring-beans.dtd">
<beans>
<bean id="BeforeAdvice" class="com.kedacom.spring.aop.BeforeAdvice"></bean>
<bean id="AfterAdvice" class="com.kedacom.spring.aop.AfterAdvice"></bean>
<bean id="CompareInterceptor" class="com.kedacom.spring.aop.CompareInterceptor"></bean>
<bean id="StudentTagget" class="com.kedacom.spring.aop.StudentImpl"></bean>
<bean id="Student" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces">
<value>
com.kedacom.spring.aop.Student.
</value>
</property>
<property name="Interceptornames">
<list>
<value>BeforeAdvice</value>
<value>AfterAdvice</value>
<value>CompareInterceptor</value>
</list>
</property>
<property name="Target">
<ref bean="StudentTagget"/>
</property>
</bean>
</beans>
<property name="proxyInterfaces">
<value>
com.kedacom.spring.aop.Student.
</value>
</property>
屁股后面那诡异的 . 是啥东西
log4j:WARN No appenders could be found for logger (org.springframework.beans.factory.xml.XmlBeanDefinitionReader).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'Student' defined in file [F:\myeclipse workspace\Spring_Aop\src\applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'Interceptornames' of bean class [org.springframework.aop.framework.ProxyFactoryBean]: Bean property 'Interceptornames' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?
org.springframework.beans.NotWritablePropertyException: Invalid property 'Interceptornames' of bean class [org.springframework.aop.framework.ProxyFactoryBean]: Bean property 'Interceptornames' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:796)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:716)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:844)
at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:871)
at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:860)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:926)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:727)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:336)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:271)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:312)
at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:82)
at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:67)
at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:58)
at com.kedacom.spring.aop.Test.main(Test.java:10)
Bean property 'Interceptornames' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?get / set 函数没写