Spring 启动执行器 - 404 错误,即使所有配置都已完成
Spring boot actuator - 404 error even when all configurations are done
我有这个 spring 引导项目,我需要为其引入执行器设置。
pom.xml:
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
<relativePath />
</parent>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
application.properties:
server.port = 8099
management.endpoints.web.base-path=/manage
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
server.error.whitelabel.enabled=false
security.basic.enabled=false
management.security.enabled=false
上下文根:
System.setProperty("server.context-path", "/ims-web");
现在,使用 GET
尝试以下 URLS。每次我收到相同的 404 Not Found
- http://localhost:8099/manage/health
- http://localhost:8099/ims-web/manage/health
- http://localhost:8099/ims-web/actuator/health
- http://localhost:8099/actuator/health
我是不是漏掉了什么?
更新 1:
启动日志:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/Maven/Dependencies/ch/qos/logback/logback-classic/1.1.11/logback-classic-1.1.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/Maven/Dependencies/org/apache/logging/log4j/log4j-slf4j-impl/2.7/log4j-slf4j-impl-2.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
Ignoring Class-Path entry activation.jar found inD:\Maven\Dependencies\javax\mail\mail.4\mail-1.4.jar as D:\Maven\Dependencies\javax\mail\mail.4\activation.jar does not exist
20:37:28.476 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Included patterns for restart : []
20:37:28.483 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Excluded patterns for restart : [/spring-boot-starter/target/classes/, /spring-boot-autoconfigure/target/classes/, /spring-boot-starter-[\w-]+/, /spring-boot/target/classes/, /spring-boot-actuator/target/classes/, /spring-boot-devtools/target/classes/]
20:37:28.484 [main] DEBUG org.springframework.boot.devtools.restart.ChangeableUrls - Matching URLs for reloading : [file:/D:/EclipseWorkspaces/Workspace/ims-web/target/classes/, file:/D:/EclipseWorkspaces/Workspace/ims/target/classes/]
. ____ _ __ _ _
/\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.3.RELEASE)
2020-09-25 20:37:29.108 INFO 272 --- [ restartedMain] com.cts.imsweb.ImsWebApplication : Starting ImsWebApplication on PC1 with PID 272 (D:\EclipseWorkspaces\Workspace\ims-web\target\classes started by Mike in D:\EclipseWorkspaces\Workspace\ims-web)
2020-09-25 20:37:29.110 INFO 272 --- [ restartedMain] com.cts.imsweb.ImsWebApplication : No active profile set, falling back to default profiles: default
2020-09-25 20:37:29.656 INFO 272 --- [ restartedMain] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2c317ddc: startup date [Fri Sep 25 20:37:29 IST 2020]; root of context hierarchy
2020-09-25 20:37:31.703 INFO 272 --- [ restartedMain] o.s.b.f.xml.XmlBeanDefinitionReader : Loading XML bean definitions from class path resource [applicationContext.xml]
2020-09-25 20:37:34.329 INFO 272 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8099 (http)
2020-09-25 20:37:34.349 INFO 272 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service Tomcat
2020-09-25 20:37:34.351 INFO 272 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.14
2020-09-25 20:37:34.703 INFO 272 --- [ost-startStop-1] o.a.c.c.C.[.[localhost].[/ims-web] : Initializing Spring embedded WebApplicationContext
2020-09-25 20:37:34.703 INFO 272 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 5047 ms
2020-09-25 20:37:35.626 INFO 272 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2020-09-25 20:37:35.633 INFO 272 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'metricsFilter' to: [/*]
2020-09-25 20:37:35.633 INFO 272 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2020-09-25 20:37:35.634 INFO 272 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2020-09-25 20:37:35.634 INFO 272 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2020-09-25 20:37:35.634 INFO 272 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2020-09-25 20:37:35.634 INFO 272 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webRequestLoggingFilter' to: [/*]
2020-09-25 20:37:35.634 INFO 272 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'applicationContextIdFilter' to: [/*]
2020-09-25 20:37:36.360 INFO 272 --- [ restartedMain] o.s.j.d.DriverManagerDataSource : Loaded JDBC driver: oracle.jdbc.driver.OracleDriver
2020-09-25 20:37:37.248 INFO 272 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2c317ddc: startup date [Fri Sep 25 20:37:29 IST 2020]; root of context hierarchy
2020-09-25 20:37:37.373 INFO 272 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/products],methods=[POST],produces=[application/json]}" onto public org.springframework.http.ResponseEntity<?> com.cts.imsweb.controller.ImsWebController.products()
2020-09-25 20:37:37.378 INFO 272 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/],methods=[GET]}" onto public java.lang.String com.cts.imsweb.controller.WebController.home()
2020-09-25 20:37:37.378 INFO 272 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/404],methods=[GET]}" onto public java.lang.String com.cts.imsweb.controller.WebController.error404()
2020-09-25 20:37:37.379 INFO 272 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/products],methods=[GET]}" onto public java.lang.String com.cts.imsweb.controller.WebController.products()
2020-09-25 20:37:37.386 INFO 272 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2020-09-25 20:37:37.386 INFO 272 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2020-09-25 20:37:37.424 INFO 272 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/products] onto handler of type [class org.springframework.web.servlet.mvc.ParameterizableViewController]
2020-09-25 20:37:37.424 INFO 272 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/404] onto handler of type [class org.springframework.web.servlet.mvc.ParameterizableViewController]
2020-09-25 20:37:37.468 INFO 272 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2020-09-25 20:37:37.468 INFO 272 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2020-09-25 20:37:37.475 INFO 272 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler]
2020-09-25 20:37:37.587 INFO 272 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2020-09-25 20:37:39.116 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/dump || /dump.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2020-09-25 20:37:39.118 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/metrics/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint.value(java.lang.String)
2020-09-25 20:37:39.118 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/metrics || /metrics.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2020-09-25 20:37:39.119 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/trace || /trace.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2020-09-25 20:37:39.120 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/configprops || /configprops.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2020-09-25 20:37:39.122 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/autoconfig || /autoconfig.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2020-09-25 20:37:39.123 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/env/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EnvironmentMvcEndpoint.value(java.lang.String)
2020-09-25 20:37:39.124 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/env || /env.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2020-09-25 20:37:39.125 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/beans || /beans.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2020-09-25 20:37:39.128 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/heapdump || /heapdump.json],methods=[GET],produces=[application/octet-stream]}" onto public void org.springframework.boot.actuate.endpoint.mvc.HeapdumpMvcEndpoint.invoke(boolean,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.io.IOException,javax.servlet.ServletException
2020-09-25 20:37:39.129 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/health || /health.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(javax.servlet.http.HttpServletRequest,java.security.Principal)
2020-09-25 20:37:39.131 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/auditevents || /auditevents.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public org.springframework.http.ResponseEntity<?> org.springframework.boot.actuate.endpoint.mvc.AuditEventsMvcEndpoint.findByPrincipalAndAfterAndType(java.lang.String,java.util.Date,java.lang.String)
2020-09-25 20:37:39.132 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/info || /info.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2020-09-25 20:37:39.135 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/loggers/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.LoggersMvcEndpoint.get(java.lang.String)
2020-09-25 20:37:39.136 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/loggers/{name:.*}],methods=[POST],consumes=[application/vnd.spring-boot.actuator.v1+json || application/json],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.LoggersMvcEndpoint.set(java.lang.String,java.util.Map<java.lang.String, java.lang.String>)
2020-09-25 20:37:39.136 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/loggers || /loggers.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2020-09-25 20:37:39.137 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/mappings || /mappings.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2020-09-25 20:37:39.591 INFO 272 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2020-09-25 20:37:40.068 INFO 272 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2020-09-25 20:37:40.087 INFO 272 --- [ restartedMain] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0
2020-09-25 20:37:40.398 INFO 272 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8099 (http)
2020-09-25 20:37:40.407 INFO 272 --- [ restartedMain] com.cts.imsweb.ImsWebApplication : Started ImsWebApplication in 11.883 seconds (JVM running for 15.683)
server.port = 8099
management.endpoints.web.base-path=/manage
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
server.error.whitelabel.enabled=false
security.basic.enabled=false
management.security.enabled=false
server.servlet.context-path= /ims-web
如果您同时使用 context-path 和 web-base-path,那么您将获得以下健康状况:
http://localhost:8099/ims-web/manage/health
#management.endpoints.web.base-path=/manage
如果您没有使用上面的代码,您将获得以下健康状况:
http://localhost:8099/ims-web/actuator/health
#server.servlet.context-path= /ims-web
如果您在代码中选择退出 context-path,则必须使用:
http://localhost:8099/actuator/health
如前所述,我项目的 spring 版本是 1.5.3。但是我已经提到执行器上下文路径为:
management.endpoints.web.base-path=/manage
但是对于2x以下的版本,正确的格式是:
management.context-path=/manage
这解决了我的问题。
终点现在是http://localhost:8099/ims-web/manage/health
我有这个 spring 引导项目,我需要为其引入执行器设置。
pom.xml:
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
<relativePath />
</parent>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
application.properties:
server.port = 8099
management.endpoints.web.base-path=/manage
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
server.error.whitelabel.enabled=false
security.basic.enabled=false
management.security.enabled=false
上下文根:
System.setProperty("server.context-path", "/ims-web");
现在,使用 GET
尝试以下 URLS。每次我收到相同的 404 Not Found
- http://localhost:8099/manage/health
- http://localhost:8099/ims-web/manage/health
- http://localhost:8099/ims-web/actuator/health
- http://localhost:8099/actuator/health
我是不是漏掉了什么?
更新 1: 启动日志:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/Maven/Dependencies/ch/qos/logback/logback-classic/1.1.11/logback-classic-1.1.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/Maven/Dependencies/org/apache/logging/log4j/log4j-slf4j-impl/2.7/log4j-slf4j-impl-2.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
Ignoring Class-Path entry activation.jar found inD:\Maven\Dependencies\javax\mail\mail.4\mail-1.4.jar as D:\Maven\Dependencies\javax\mail\mail.4\activation.jar does not exist
20:37:28.476 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Included patterns for restart : []
20:37:28.483 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Excluded patterns for restart : [/spring-boot-starter/target/classes/, /spring-boot-autoconfigure/target/classes/, /spring-boot-starter-[\w-]+/, /spring-boot/target/classes/, /spring-boot-actuator/target/classes/, /spring-boot-devtools/target/classes/]
20:37:28.484 [main] DEBUG org.springframework.boot.devtools.restart.ChangeableUrls - Matching URLs for reloading : [file:/D:/EclipseWorkspaces/Workspace/ims-web/target/classes/, file:/D:/EclipseWorkspaces/Workspace/ims/target/classes/]
. ____ _ __ _ _
/\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.3.RELEASE)
2020-09-25 20:37:29.108 INFO 272 --- [ restartedMain] com.cts.imsweb.ImsWebApplication : Starting ImsWebApplication on PC1 with PID 272 (D:\EclipseWorkspaces\Workspace\ims-web\target\classes started by Mike in D:\EclipseWorkspaces\Workspace\ims-web)
2020-09-25 20:37:29.110 INFO 272 --- [ restartedMain] com.cts.imsweb.ImsWebApplication : No active profile set, falling back to default profiles: default
2020-09-25 20:37:29.656 INFO 272 --- [ restartedMain] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2c317ddc: startup date [Fri Sep 25 20:37:29 IST 2020]; root of context hierarchy
2020-09-25 20:37:31.703 INFO 272 --- [ restartedMain] o.s.b.f.xml.XmlBeanDefinitionReader : Loading XML bean definitions from class path resource [applicationContext.xml]
2020-09-25 20:37:34.329 INFO 272 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8099 (http)
2020-09-25 20:37:34.349 INFO 272 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service Tomcat
2020-09-25 20:37:34.351 INFO 272 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.14
2020-09-25 20:37:34.703 INFO 272 --- [ost-startStop-1] o.a.c.c.C.[.[localhost].[/ims-web] : Initializing Spring embedded WebApplicationContext
2020-09-25 20:37:34.703 INFO 272 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 5047 ms
2020-09-25 20:37:35.626 INFO 272 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2020-09-25 20:37:35.633 INFO 272 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'metricsFilter' to: [/*]
2020-09-25 20:37:35.633 INFO 272 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2020-09-25 20:37:35.634 INFO 272 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2020-09-25 20:37:35.634 INFO 272 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2020-09-25 20:37:35.634 INFO 272 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2020-09-25 20:37:35.634 INFO 272 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webRequestLoggingFilter' to: [/*]
2020-09-25 20:37:35.634 INFO 272 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'applicationContextIdFilter' to: [/*]
2020-09-25 20:37:36.360 INFO 272 --- [ restartedMain] o.s.j.d.DriverManagerDataSource : Loaded JDBC driver: oracle.jdbc.driver.OracleDriver
2020-09-25 20:37:37.248 INFO 272 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2c317ddc: startup date [Fri Sep 25 20:37:29 IST 2020]; root of context hierarchy
2020-09-25 20:37:37.373 INFO 272 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/products],methods=[POST],produces=[application/json]}" onto public org.springframework.http.ResponseEntity<?> com.cts.imsweb.controller.ImsWebController.products()
2020-09-25 20:37:37.378 INFO 272 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/],methods=[GET]}" onto public java.lang.String com.cts.imsweb.controller.WebController.home()
2020-09-25 20:37:37.378 INFO 272 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/404],methods=[GET]}" onto public java.lang.String com.cts.imsweb.controller.WebController.error404()
2020-09-25 20:37:37.379 INFO 272 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/products],methods=[GET]}" onto public java.lang.String com.cts.imsweb.controller.WebController.products()
2020-09-25 20:37:37.386 INFO 272 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2020-09-25 20:37:37.386 INFO 272 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2020-09-25 20:37:37.424 INFO 272 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/products] onto handler of type [class org.springframework.web.servlet.mvc.ParameterizableViewController]
2020-09-25 20:37:37.424 INFO 272 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/404] onto handler of type [class org.springframework.web.servlet.mvc.ParameterizableViewController]
2020-09-25 20:37:37.468 INFO 272 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2020-09-25 20:37:37.468 INFO 272 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2020-09-25 20:37:37.475 INFO 272 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler]
2020-09-25 20:37:37.587 INFO 272 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2020-09-25 20:37:39.116 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/dump || /dump.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2020-09-25 20:37:39.118 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/metrics/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint.value(java.lang.String)
2020-09-25 20:37:39.118 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/metrics || /metrics.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2020-09-25 20:37:39.119 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/trace || /trace.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2020-09-25 20:37:39.120 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/configprops || /configprops.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2020-09-25 20:37:39.122 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/autoconfig || /autoconfig.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2020-09-25 20:37:39.123 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/env/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EnvironmentMvcEndpoint.value(java.lang.String)
2020-09-25 20:37:39.124 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/env || /env.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2020-09-25 20:37:39.125 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/beans || /beans.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2020-09-25 20:37:39.128 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/heapdump || /heapdump.json],methods=[GET],produces=[application/octet-stream]}" onto public void org.springframework.boot.actuate.endpoint.mvc.HeapdumpMvcEndpoint.invoke(boolean,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.io.IOException,javax.servlet.ServletException
2020-09-25 20:37:39.129 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/health || /health.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(javax.servlet.http.HttpServletRequest,java.security.Principal)
2020-09-25 20:37:39.131 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/auditevents || /auditevents.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public org.springframework.http.ResponseEntity<?> org.springframework.boot.actuate.endpoint.mvc.AuditEventsMvcEndpoint.findByPrincipalAndAfterAndType(java.lang.String,java.util.Date,java.lang.String)
2020-09-25 20:37:39.132 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/info || /info.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2020-09-25 20:37:39.135 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/loggers/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.LoggersMvcEndpoint.get(java.lang.String)
2020-09-25 20:37:39.136 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/loggers/{name:.*}],methods=[POST],consumes=[application/vnd.spring-boot.actuator.v1+json || application/json],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.LoggersMvcEndpoint.set(java.lang.String,java.util.Map<java.lang.String, java.lang.String>)
2020-09-25 20:37:39.136 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/loggers || /loggers.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2020-09-25 20:37:39.137 INFO 272 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/mappings || /mappings.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2020-09-25 20:37:39.591 INFO 272 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2020-09-25 20:37:40.068 INFO 272 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2020-09-25 20:37:40.087 INFO 272 --- [ restartedMain] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0
2020-09-25 20:37:40.398 INFO 272 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8099 (http)
2020-09-25 20:37:40.407 INFO 272 --- [ restartedMain] com.cts.imsweb.ImsWebApplication : Started ImsWebApplication in 11.883 seconds (JVM running for 15.683)
server.port = 8099
management.endpoints.web.base-path=/manage
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
server.error.whitelabel.enabled=false
security.basic.enabled=false
management.security.enabled=false
server.servlet.context-path= /ims-web
如果您同时使用 context-path 和 web-base-path,那么您将获得以下健康状况: http://localhost:8099/ims-web/manage/health
#management.endpoints.web.base-path=/manage
如果您没有使用上面的代码,您将获得以下健康状况: http://localhost:8099/ims-web/actuator/health
#server.servlet.context-path= /ims-web
如果您在代码中选择退出 context-path,则必须使用: http://localhost:8099/actuator/health
如前所述,我项目的 spring 版本是 1.5.3。但是我已经提到执行器上下文路径为:
management.endpoints.web.base-path=/manage
但是对于2x以下的版本,正确的格式是:
management.context-path=/manage
这解决了我的问题。
终点现在是http://localhost:8099/ims-web/manage/health