Spring Boot <= 1.3

No need to define one, Spring Boot automatically defines one for you.
(springboot1.3版本以前不需要自定义一个RestTemplate,springboot为你自动定义了一个)

Spring Boot >= 1.4

Spring Boot no longer automatically defines a RestTemplate but instead defines a RestTemplateBuilder allowing you more control over the RestTemplate that gets created. You can inject the RestTemplateBuilder as an argument in your @Bean method to create a RestTemplate:
(springboot1.4版本以后需要在启动器里自定义RestTemplate,即在启动器中加入如下代码即可在类中正常使用@Autowired进行注入)

@Bean
    public RestTemplate restTemplate(RestTemplateBuilder builder){
        return builder.build();
    }

参考自:RestTemplate注入_danielinbiti的博客-CSDN博客_resttemplate注入

服务启动报错:Consider defining a bean of type ‘.RestTemplate‘ in your configuration相关推荐

  1. 解决启动报错Consider defining a bean of type ‘xxx‘ in your configuration.

    解决启动报错Consider defining a bean of type 'xxx' in your configuration. 报错截图 解决方法:查看注解是否同时存在@AllArgsCons ...

  2. springboot启动报错: Consider defining a bean of type ‘XXX‘ in your configuration

    Consider defining a bean of type 'XXX' in your configuration 出现这个错误,要看看你是否用到了某些组件,但是启动类上没加相应的注解.比如说我 ...

  3. SpringCloud - 整合Nacos启动报错Consider defining a bean of type IClientConfig

    SpringCloud - 整合Nacos启动报错Consider defining a bean of type IClientConfig 前言 一. 尝试解决Bug的几种不合适方案 1.1 添加 ...

  4. 【微服务】 网关启动报错 Consider defining a bean of type org.springframework.http.codec.ServerCodecConfigurer

    一.现象 微服务启动时报错:Consider defining a bean of type 'org.springframework.http.codec.ServerCodecConfigurer ...

  5. SpringBoot启动报错Consider defining a bean of type ‘com.test.springmvc.dao.xx‘ in your configuration.

    报错信息如下: Description:Field userDao in com.test.springmvc.service.impl.UserServiceImpl required a bean ...

  6. Spring Cloud/Boot启动报错Consider defining a bean of type ServerCodecConfigurer

    网关项目启动报错内容如下: Error starting ApplicationContext. To display the conditions report re-run your applic ...

  7. [SpringBoot报错]Consider defining a bean of type ‘xxx‘ in your configuration, NoSuchBeanDefinitionExce

    报错详情: Error starting ApplicationContext. To display the conditions report re-run your application wi ...

  8. spring boot 启动报错:No qualifying bean of type org.springframework.security.oauth2.provider.token.Toke

    spring boot启动报错: Exception encountered during context initialization - cancelling refresh attempt: o ...

  9. 项目启动报错:No qualifying bean of type ‘xxx‘ available:

    项目启动报错: Description: A component required a bean of type 'cn.hsa.its.abutment.bo.BusinessAcceptBo' t ...

  10. springboot 启动报错:required a bean of type 'xxxRepository' that could not be found

    springboot启动的时候报错,错误如下: Field demoRepository in com.ge.serviceImpl.DemoServiceImpl required a bean o ...

最新文章

  1. 图解深度学习(图灵出品)
  2. VMware vSphere开发(1)安装配置VMware vSphere Web Services SDK的运行环境
  3. time.h 详细介绍
  4. C# HttpHelper帮助类,真正的Httprequest请求时无视编码,无视证书,无视Cookie,网页抓取...
  5. Oracle删库跑路
  6. 今天刚学的idea的debug打断点,Ctrl+u进入Evaluate Expression界面,调试程序事半功倍!
  7. python中常用的模块二
  8. java io 文件路径_如何从Java项目中的相对路径读取文件? java.io.File找不到指定的路径...
  9. 向mysql中插入时间_Java向mysql中插入时间的方法
  10. Google Chrome进入暗黑模式
  11. python 递归的最大层数_练习题-Python的最大递归层数
  12. 制作属于自己的个人博客-超详细教程
  13. TPC_mcgs打印方案
  14. LR破解版录制手机脚本
  15. MFC实现文字随鼠标移动
  16. figma安装包_Figma软件下载|UI界面设计软件(Figma)下载 v3.0.4 官方版 - 比克尔下载...
  17. Android之APP跳转权限设置界面
  18. Mysql5.7 的错误日志中最常见的note级别日志解释
  19. 嵌入式lab3——自行车码表
  20. 全球免费公共 DNS 解析服务器 IP 地址列表推荐 (解决无法上网/加速/防劫持)

热门文章

  1. 6个Excel快速操作小技巧,早会早下班
  2. 长连接和短连接原理浅析
  3. 基于Web系统的测试方法(常见测试案例)-经验
  4. 老大哥:编译JDK好难呀,我要放弃Java了,我:别呀,看我的
  5. 房子装修工程师CSS(一)之盒子模型/选择器的权重计算/常见样式属性/浮动float
  6. mac上爱思助手连接iphone一闪一闪的
  7. halcon系列:高斯混合模型之create_class_gmm 算子
  8. Dreamweaver cs6 下载
  9. AR内容开发--AR开发引擎和SDK
  10. 【Echarts教科书】Echarts数据统计图表教学(详细)