执行器不适用于非弹簧启动应用程序

时间:2019-03-29 01:53:10

标签: spring http-status-code-404 spring-boot-actuator

我有一个现有的Spring Application,我正在尝试将执行器绑定到它。通过可用的示例和文档,我在pom.xml中添加了依赖项

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-actuator</artifactId>
        <version>1.5.10.RELEASE</version>
    </dependency>

我在servlet.xml中添加了以下配置

  <bean id="endpointAutoConfiguration" class="org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration"/>
  <bean id="publicMetricsAutoConfiguration" class="org.springframework.boot.actuate.autoconfigure.PublicMetricsAutoConfiguration"/>
  <bean id="healthIndicatorAutoConfiguration" class="org.springframework.boot.actuate.autoconfigure.HealthIndicatorAutoConfiguration"/>

具有以下配置

endpoints.health.enabled=true
endpoints.health.id=health
endpoints.health.enabled=true
management.security.enabled=false
endpoints.health.sensitive=false
server.port=8080
management.endpoints.web.base-path=/
management.endpoints.web.exposure.include=*
endpoints.actuator.enabled=true
endpoints.logfile.enabled=true

在调试时,我看到在类org.springframework.boot.actuate.endpoint中,为健康状况指示器DataSourceHealthIndicatorDiskSpaceHealtIndicatorJmsHealthIndicator选择了3个类,并且所选择的详细信息对自动连线的实例。

在调试模式下启用springframework日志时,我在日志中的以下行中看到了与执行器相关的许多属性

07:04:01,302 DEBUG [localhost-startStop-1]: JndiLocatorDelegate  ReqId:() DFReqId:() - Converted JNDI name [java:comp/env/endpoints.health.enabled] not found - trying original name [endpoints.health.enabled]. javax.naming.NameNotFoundException: Name [endpoints.health.enabled] is not bound in this Context. Unable to find [endpoints.health.enabled].

没有得到指针,我所缺少的。

http://localhost:8080/healthhttp://localhost:8080/info上获得404异常

0 个答案:

没有答案