我有这个spring boot项目,我需要引入一个执行器设置。
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>
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
尝试以下URL。每次我收到相同的404找不到
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\1.4\mail-1.4.jar as D:\Maven\Dependencies\javax\mail\mail\1.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/acturet/health
#server.servlet.context-path= /ims-web
如果在代码中选择不使用上下文路径,则必须使用:http://localhost:8099/actulator/health
从这份官方文件中,很难确定这两个模块之间有什么区别。 谁能提供一个官方和规范的答案来解释两者的区别吗?
试图在Web应用程序中提供自定义404错误页面,据我所知,该应用程序使用Java配置(因此没有web.xml)。 我们有以下版本的相关库:Spring("5.1.2. RELEASE")、sping-Security("5.1.1. RELEASE")。 我在StackOverflow中检查了这里的不同方法。请不要建议web.xml、Thymeleaf或Spring Boot的结果。这不适用。 其
按预期列出了这些组: 和按预期工作: 但是,和都返回和。 我想要的探测记录在自动配置的HealthIndicator列表中。 在https://spring.io/blog/2020/03/25/liveness-and-readid-probes-with-spring-boot中也介绍了该特性。 我尝试了的几个拼写,插入了(在博客文章中),但没有效果。 这里有一个相关的答案,但它并不直接解决我
问题内容: 我有一个带有IF-ELSE块的SQL代码。IF部分中的代码不应该到达,但是在执行SQL时仍然出现错误。在我首先测试链接服务器的代码中,当它失败时,将其设置为1,并且该块应执行并避免需要查询链接服务器的块中的代码,但是出现此错误: 我正在SSMS 2012中运行查询。为什么会发生此错误? -下列插入SQL语句导致错误 问题答案: 在执行之前,它仍然会解析并绑定所有内容。它没有绑定到这里。
我正在尝试运行一个Spring Boot应用程序。我从教程中下载了一段代码,这样我就知道这段代码可以工作。当我运行我的jar文件时,它看起来就像我在8080端口上运行的应用程序,但我仍然得到404对于任何URL来说,我从来没有得到spring白色标签页面。我检查了8080端口上没有任何其他东西在运行,并且服务器已经启动并运行。 我不知道为什么我的申请没有反应。 } http://maven.apa
背景资料 Spring Actuctor提供的管理URL在点击关闭后似乎仍然运行良好。 发布前控制台输出 10:01:42.496[main]INFO O.s.B.C.E.T.TomCatEmbeddedServletContainer-Tomcat在端口上启动:8002(http)10:01:42.499[main]INFO com.xyz.api.main-在5.956秒内启动main(JVM