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類中添加一個無參構造函數

在這裏插入圖片描述成功解決

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章