gpt4 book ai didi

java - 如何使用spring boot admin 2版本和spring boot 1.5版本?

转载 作者:行者123 更新时间:2023-12-02 01:37:32 28 4
gpt4 key购买 nike

我有以下依赖项:

dependencies {
compile('org.springframework.boot:spring-boot-starter')
compile group: 'de.codecentric', name: 'spring-boot-admin-server-ui', version: '2.1.3'
compile group: 'de.codecentric', name: 'spring-boot-admin-server', version: '2.1.3'
testCompile('org.springframework.boot:spring-boot-starter-test')
}

springBootVersion = '1.5.3.RELEASE'

当我尝试启动我的应用程序时:

@EnableAdminServer
@SpringBootApplication
public class MonitoringAdminApplication {

public static void main(String[] args) {
SpringApplication.run(MonitoringAdminApplication.class, args);
}

}

我看到错误:

Exception in thread "main" java.lang.NoClassDefFoundError: org/thymeleaf/spring5/templateresolver/SpringResourceTemplateResolver
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:613)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:524)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:510)
at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:570)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:697)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:640)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:609)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1484)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:425)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:395)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:515)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:508)
at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1189)
at org.springframework.boot.SpringApplication.getExitCodeFromMappedException(SpringApplication.java:862)
at org.springframework.boot.SpringApplication.getExitCodeFromException(SpringApplication.java:848)
at org.springframework.boot.SpringApplication.handleExitCode(SpringApplication.java:834)
at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:788)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:325)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151)
at com.******.MonitoringAdminApplication.main(MonitoringAdminApplication.java:13)
Caused by: java.lang.ClassNotFoundException: org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 24 more

我尝试将 spring-boot-admin-server-uispring-boot-admin-server 版本降级到 1.5.5 应用程序成功启动后。

但我想使用最新版本。我无法使用 Spring Boot 2。

如何修复它?

最佳答案

你不能也不应该。 Spring-boot-admin 与任何其他 Spring Boot 应用程序一样,是在特定的 Spring Boot 版本上开发的。

  • spring-boot-admin 1.5.x基于Spring Boot 1.5.x
  • spring-boot-admin 2.0.x基于Spring Boot 2.0.x
  • spring-boot-admin 2.1.x基于Spring Boot 2.1.x

如果您坚持使用 Spring Boot 1.5,那么您应该使用 spring-boot-admin 1.5.7(1.5.x 分支的最新版本)。

关于java - 如何使用spring boot admin 2版本和spring boot 1.5版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55011682/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com