【发布时间】:2020-07-27 17:16:20
【问题描述】:
我有我的 spring-boot 应用程序,带有 spring-boot-starter-web,然后我将 spring-boot-starter-actuator 添加到 gradle 文件中。没有编译错误。但是当我尝试运行服务器时,它给出了以下异常。
我的 build.gradle 内容(仅包括主要内容)
plugins {
id 'org.springframework.boot' version '2.1.3.RELEASE'
} ...........
compile "org.springframework.boot:spring-boot-starter-actuator"
compile group: 'io.micrometer', name: 'micrometer-registry-prometheus', version: '1.1.3' .........
我的 application.properties 内容
server.port = 2128
spring.couchbase.env.timeouts.connect=10000
spring.couchbase.env.timeouts.query=180000
spring.couchbase.env.timeouts.view=20000
spring.couchbase.bootstrap-hosts=localhost
spring.couchbase.bucket.name=localdb
spring.couchbase.bucket.password=*****
spring.data.couchbase.repositories.type=auto
spring.data.couchbase.auto-index=true
server.compression.enabled=true
server.compression.mime-types=application/json,text/plain
spring.servlet.multipart.enabled=true
spring.servlet.multipart.maxFileSize=50MB
spring.servlet.multipart.maxRequestSize=50MB
我的应用程序.java
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
启动服务器时出现以下异常。
org.springframework.context.ApplicationContextException:无法启动网络服务器; 嵌套异常是 org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat 原因:org.springframework.beans.factory.BeanCreationException:创建类路径资源中定义的名称为“servletEndpointRegistrar”的bean时出错 WebMvcServletEndpointManagementContextConfiguration.class]:通过工厂方法进行 Bean 实例化失败;嵌套异常是 org.springframework.beans.BeanInstantiationException: 无法实例化 [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]:工厂方法 'servletEndpointRegistrar' 抛出异常; 嵌套异常是 org.springframework.beans.factory.UnsatisfiedDependencyException:创建类路径资源中定义的名称为“healthEndpoint”的 bean 时出错 org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]:通过方法'healthEndpoint'参数1表示的不满足的依赖关系; 嵌套异常是 org.springframework.beans.factory.BeanCreationException:在类路径资源 [org/springframework/boot/actuate/autoconfigure/health/HealthIndicatorAutoConfiguration.class] 中定义名称为“healthIndicatorRegistry”的 bean 创建错误:通过工厂方法进行 Bean 实例化失败有什么有用的提示吗?
【问题讨论】:
标签: spring-boot spring-boot-actuator