SpringBoot 項(xiàng)目啟動時報(bào)錯:
?No qualifying bean of type 'org.springframework.web.client.RestTemplate' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
?
?產(chǎn)生原因:由于springboot版本問題,當(dāng)前項(xiàng)目的版本需要交給spring容器管理。
問題解決:
在項(xiàng)目啟動類中加入以下代碼:文章來源:http://www.zghlxwxcb.cn/news/detail-762366.html
? ? @Bean
? ? public RestTemplate restTemplate(RestTemplateBuilder builder) {
? ? ? ? return builder.build();
? ? }
? ??文章來源地址http://www.zghlxwxcb.cn/news/detail-762366.html
到了這里,關(guān)于解決:No qualifying bean of type ‘org.springframework.web.client.RestTemplate‘ available:的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!