仅升级了Spring Boot Admin服务器和客户端。服务器启动正常。启动客户端时,出现以下异常。
在上下文初始化期间遇到异常-取消刷新尝试:org.springframework.beans.factory.BeanCreationException:在类路径资源[de / codecentric / boot / admin / client / config / SpringBootAdminClientAutoConfiguration中创建名称为'registrator'的bean时出错.class]:通过工厂方法实例化Bean失败;嵌套的异常是org.springframework.beans.BeanInstantiationException:无法实例化[de.codecentric.boot.admin.client.registration.ApplicationRegistrator]:工厂方法'registrator'引发了异常;嵌套的异常是java.lang.NoSuchMethodError:org.springframework.boot.web.client.RestTemplateBuilder.setConnectTimeout(Ljava / time / Duration;)Lorg / springframework / boot / web / client / RestTemplateBuilder;
我怀疑问题出在Spring Rest,但我不知道为什么。那是您可以帮助我的事情吗?
这是我使用的版本。
<spring-boot-dependencies.version>2.1.6.RELEASE</spring-boot-dependencies.version>
<spring.version>5.1.8.RELEASE</spring.version>
<spring-boot-admin.version>2.1.4</spring-boot-admin.version>
客户端配置
@Configuration
public class AdminPanelConfigurationDefault
{
private static final Logger logger = LoggerFactory.getLogger(AdminPanelConfigurationDefault.class);
@Bean
public ApplicationFactory applicationFactory(InstanceProperties instance,
ManagementServerProperties management,
ServerProperties server,
ServletContext servletContext,
PathMappedEndpoints pathMappedEndpoints,
WebEndpointProperties webEndpoint,
MetadataContributor metadataContributor,
DispatcherServletPath dispatcherServletPath,
@Qualifier(CommonApplicationConfig.RUNNING_APP_BEAN_NAME) Application application)
{
String applicationURL = application.getUrl();
logger.debug("Setting serviceBaseUrl to {} from the app table", applicationURL);
instance.setServiceUrl(applicationURL);
return new ServletApplicationFactory(instance, management, server, servletContext, pathMappedEndpoints,
webEndpoint, metadataContributor, dispatcherServletPath);
}
}
我非常感谢您可以提供的任何建议。谢谢。