永发信息网

org.springframework.beans.factory.BeanCreationException: Autowiring of fields failed;

答案:2  悬赏:40  手机版
解决时间 2021-03-08 17:24
  • 提问者网友:斑駁影
  • 2021-03-07 20:16
参照这个里面的内容写的spring注解http://blog.csdn.net/xyh820/article/details/7303330/
使用@Autowired注解的时候抛异常:(注解在属性和setter方法上都是抛异常的)
Exception in thread "main"
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'boss': Autowiring of fields failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not
autowire field: private testSpringAnnotation.Car
testSpringAnnotation.Boss.car; nested exception is
java.lang.NoSuchMethodError:
org.springframework.beans.factory.config.ConfigurableListableBeanFactory.resolveDependency(Lorg/springframework/beans/factory/config/DependencyDescriptor;Ljava/lang/String;Ljava/util/Set;Lorg/springframework/beans/TypeConverter;)Ljava/lang/Object;

spring配置:










public class Boss {
@Autowired
private Car car;
@Autowired
private Office office;
...
}

恳求大侠指点
最佳答案
  • 五星知识达人网友:末日狂欢
  • 2021-03-07 20:43
car、office没有get/set

。。。。。。
全部回答
  • 1楼网友:孤独入客枕
  • 2021-03-07 22:03
could not instantiate bean class 可能spring配置的class根本就没有这个类
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯