UnsatisfiedDependencyException

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'person' defined in file [D:\code\download\SpringBoot-master\annotation\target\classes\com\example\annotation\bean\Person.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.lang.String' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}

今天在打印Bean时候报了这样一个错误,查了网上的方法。
需要在Person类中添加一个无参构造函数

UnsatisfiedDependencyException_第1张图片成功解决

你可能感兴趣的:(后端)