Could not autowire. No beans of 'PeopleService' type found.
时间: 2023-10-28 10:20:41 浏览: 43
"Could not autowire. No beans of 'PeopleService' type found."这个错误通常表示在自动装配时找不到名为'PeopleService'类型的bean。这个问题可能出现在Spring框架中,当你尝试使用@Autowired或@Inject等注解来自动装配bean时。这个错误可能有以下几个原因导致:
1. 没有在Spring上下文中定义'PeopleService' bean。你需要确保在配置文件或使用注解的方式中正确地定义了'PeopleService' bean。
2. 你可能忘记在'PeopleService'类上添加@Component或@Service等注解,以便将其识别为一个bean。请确保在类上添加了适当的注解。
3. 如果你使用的是自定义的注解,例如@XXX,你需要确保你正确地定义了这个注解,并且在'PeopleService'类上使用了该注解。
4. 如果使用的是XML配置文件,你需要检查是否正确地配置了'PeopleService' bean的定义,并且是否将其包含在Spring上下文中。
总结起来,'Could not autowire. No beans of 'PeopleService' type found.'这个错误通常是由于缺少或错误配置的bean导致的。你需要仔细检查你的代码和配置文件,确保正确地定义和配置了'PeopleService' bean。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [Could not autowire. No beans of ‘XXX‘ type found](https://blog.csdn.net/weixin_44096133/article/details/128679145)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [Could not autowire. No beans of ‘xxxMapper‘ type found.](https://blog.csdn.net/m0_58019259/article/details/130526726)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)