【发布时间】:2018-06-11 11:36:19
【问题描述】:
我正在尝试启动已使用此注释的 springboot 应用程序。当我尝试启动应用程序时,它给了我以下错误:
org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanTypeDeductionException 无法推断 com.shutterfly.sbs.platform.SbsPlatformConfigurationClientConfig.getRestTemplate 的 bean 类型
代码:
@ConditionalOnMissingBean
@Bean
public RestTemplate getRestTemplate() {
return new RestTemplate();
}
【问题讨论】:
-
只有当在上下文中找不到 RestTemplate bean 时才会初始化 bean。如果它已经有一个 RestTemplate bean,它将跳过这个。
-
谢谢@pvpkiran
标签: java spring spring-boot