当前位置: 首页 > 知识库问答 >
问题:

Spring启动2执行器配置问题

孟鹏海
2023-03-14

我想为我们的应用程序配置Spring启动致动器endpoint。下面是我的pom.xml文件,添加了Spring启动执行器依赖项。

当我启动应用程序时,我看不到文档中显示的任何注册的/application/URLendpoint。文件表明,在将致动器相关性添加到pom之后。xml,我应该在启动日志中看到额外的映射,但我没有。这里会有什么问题?

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>SpreadSheetUploadWeb</groupId>
    <artifactId>SpreadSheetUploadWeb</artifactId>
    <packaging>jar</packaging>
    <version>1.0</version>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.4.RELEASE</version>
    </parent>

    <properties>
        <java.version>1.8</java.version>
        <spring.version>5.0.8.RELEASE</spring.version>
        <spring.boot.version>2.0.4.RELEASE</spring.boot.version>
    </properties>

    <dependencies>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
            <version>${spring.boot.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
            <version>${spring.boot.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>${spring.boot.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <version>${spring.boot.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- Actuator for application Health/State monitoring -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
          <groupId>org.springframework.data</groupId>
          <artifactId>spring-data-rest-hal-browser</artifactId>
        </dependency>       

下面是一个启动日志:

2018-08-08 14:16:40 INFO  o.f.core.internal.command.DbMigrate - Schema "DB2INST " is up to date. No migration necessary.
2018-08-08 14:16:41 INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/bluecost/costspreadsheet/{uploader}],methods=[GET]}" onto public org.springframework.http.ResponseEntity<java.util.List<com.ibm.cio.cloud.cost.spreadsheet.domain.CostSpreadsheet>> com.ibm.cio.cloud.cost.spreadsheet.rest.controller.BlueCostRestController.getCostSpreadsheetByUploader(java.lang.String)
2018-08-08 14:16:41 INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/bluecost/costspreadsheet/{uploader}],methods=[GET]}" onto public org.springframework.http.ResponseEntity<java.util.List<com.ibm.cio.cloud.cost.spreadsheet.domain.CostSpreadsheet>> com.ibm.cio.cloud.cost.spreadsheet.rest.controller.BlueCostRestController.getCostSpreadsheetByUploader(java.lang.String)
2018-08-08 14:16:41 INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/bluecost/sscdata/],methods=[GET]}" onto public org.springframework.http.ResponseEntity<java.util.List<com.ibm.cio.cloud.cost.spreadsheet.domain.BluecostSSCData>> com.ibm.cio.cloud.cost.spreadsheet.rest.controller.BlueCostRestController.getAllBluecostSSCData()
2018-08-08 14:16:41 INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/bluecost/sscdata/],methods=[GET]}" onto public org.springframework.http.ResponseEntity<java.util.List<com.ibm.cio.cloud.cost.spreadsheet.domain.BluecostSSCData>> com.ibm.cio.cloud.cost.spreadsheet.rest.controller.BlueCostRestController.getAllBluecostSSCData()
2018-08-08 14:16:41 INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/bluecost/sscdata/],methods=[POST]}" onto public org.springframework.http.ResponseEntity<?> com.ibm.cio.cloud.cost.spreadsheet.rest.controller.BlueCostRestController.createBluecostSSCData(com.ibm.cio.cloud.cost.spreadsheet.domain.BluecostSSCData)
2018-08-08 14:16:41 INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/bluecost/sscdata/],methods=[POST]}" onto public org.springframework.http.ResponseEntity<?> com.ibm.cio.cloud.cost.spreadsheet.rest.controller.BlueCostRestController.createBluecostSSCData(com.ibm.cio.cloud.cost.spreadsheet.domain.BluecostSSCData)
2018-08-08 14:16:41 INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/bluecost/spreadsheet/upload],methods=[POST]}" onto public org.springframework.http.ResponseEntity<?> com.ibm.cio.cloud.cost.spreadsheet.rest.controller.BlueCostRestController.uploadSpreadsheet(org.springframework.web.multipart.MultipartFile)
2018-08-08 14:16:41 INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/bluecost/spreadsheet/upload],methods=[POST]}" onto public org.springframework.http.ResponseEntity<?> com.ibm.cio.cloud.cost.spreadsheet.rest.controller.BlueCostRestController.uploadSpreadsheet(org.springframework.web.multipart.MultipartFile)
2018-08-08 14:16:41 INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/bluecost/spreadsheet/{uploader}/{filename}],methods=[DELETE]}" onto public org.springframework.http.ResponseEntity<?> com.ibm.cio.cloud.cost.spreadsheet.rest.controller.BlueCostRestController.deleteUploadedSpreadsheet(java.lang.String,java.lang.String)
2018-08-08 14:16:41 INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/bluecost/spreadsheet/{uploader}/{filename}],methods=[DELETE]}" onto public org.springframework.http.ResponseEntity<?> com.ibm.cio.cloud.cost.spreadsheet.rest.controller.BlueCostRestController.deleteUploadedSpreadsheet(java.lang.String,java.lang.String)
2018-08-08 14:16:41 INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/bluecost/sscdata/{uploader}],methods=[GET]}" onto public org.springframework.http.ResponseEntity<?> com.ibm.cio.cloud.cost.spreadsheet.rest.controller.BlueCostRestController.findSSCDataByUploader(java.lang.String)
2018-08-08 14:16:41 INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/bluecost/sscdata/{uploader}],methods=[GET]}" onto public org.springframework.http.ResponseEntity<?> com.ibm.cio.cloud.cost.spreadsheet.rest.controller.BlueCostRestController.findSSCDataByUploader(java.lang.String)
2018-08-08 14:16:41 INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/swagger-resources/configuration/ui]}" onto public org.springframework.http.ResponseEntity<springfox.documentation.swagger.web.UiConfiguration> springfox.documentation.swagger.web.ApiResourceController.uiConfiguration()
2018-08-08 14:16:41 INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/swagger-resources/configuration/ui]}" onto public org.springframework.http.ResponseEntity<springfox.documentation.swagger.web.UiConfiguration> springfox.documentation.swagger.web.ApiResourceController.uiConfiguration()
2018-08-08 14:16:41 INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/swagger-resources]}" onto public org.springframework.http.ResponseEntity<java.util.List<springfox.documentation.swagger.web.SwaggerResource>> springfox.documentation.swagger.web.ApiResourceController.swaggerResources()
2018-08-08 14:16:41 INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/swagger-resources]}" onto public org.springframework.http.ResponseEntity<java.util.List<springfox.documentation.swagger.web.SwaggerResource>> springfox.documentation.swagger.web.ApiResourceController.swaggerResources()
2018-08-08 14:16:41 INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/swagger-resources/configuration/security]}" onto public org.springframework.http.ResponseEntity<springfox.documentation.swagger.web.SecurityConfiguration> springfox.documentation.swagger.web.ApiResourceController.securityConfiguration()
2018-08-08 14:16:41 INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/swagger-resources/configuration/security]}" onto public org.springframework.http.ResponseEntity<springfox.documentation.swagger.web.SecurityConfiguration> springfox.documentation.swagger.web.ApiResourceController.securityConfiguration()
2018-08-08 14:16:41 INFO  o.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.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-08-08 14:16:41 INFO  o.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.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-08-08 14:16:41 INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-08-08 14:16:41 INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-08-08 14:16:42 INFO  s.d.s.w.PropertySourcedRequestMappingHandlerMapping - Mapped URL path [/v2/api-docs] onto method [public org.springframework.http.ResponseEntity<springfox.documentation.spring.web.json.Json> springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)]
2018-08-08 14:16:42 INFO  s.d.s.w.PropertySourcedRequestMappingHandlerMapping - Mapped URL path [/v2/api-docs] onto method [public org.springframework.http.ResponseEntity<springfox.documentation.spring.web.json.Json> springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)]
2018-08-08 14:16:42 INFO  o.s.w.s.h.SimpleUrlHandlerMapping - Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-08-08 14:16:42 INFO  o.s.w.s.h.SimpleUrlHandlerMapping - Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-08-08 14:16:42 INFO  o.s.w.s.m.m.a.RequestMappingHandlerAdapter - Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@3967e60c: startup date [Wed Aug 08 14:16:34 MDT 2018]; root of context hierarchy
2018-08-08 14:16:42 INFO  o.s.w.s.m.m.a.RequestMappingHandlerAdapter - Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@3967e60c: startup date [Wed Aug 08 14:16:34 MDT 2018]; root of context hierarchy
2018-08-08 14:16:42 INFO  o.s.w.s.h.SimpleUrlHandlerMapping - Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-08-08 14:16:42 INFO  o.s.w.s.h.SimpleUrlHandlerMapping - Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-08-08 14:16:42 INFO  o.s.w.s.h.SimpleUrlHandlerMapping - Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-08-08 14:16:42 INFO  o.s.w.s.h.SimpleUrlHandlerMapping - Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-08-08 14:16:43 INFO  o.s.j.e.a.AnnotationMBeanExporter - Registering beans for JMX exposure on startup
2018-08-08 14:16:43 INFO  o.s.j.e.a.AnnotationMBeanExporter - Bean with name 'dataSource' has been autodetected for JMX exposure
2018-08-08 14:16:43 INFO  o.s.j.e.a.AnnotationMBeanExporter - Located MBean 'dataSource': registering with JMX server as MBean [com.zaxxer.hikari:name=dataSource,type=HikariDataSource]
2018-08-08 14:16:43 INFO  o.s.c.s.DefaultLifecycleProcessor - Starting beans in phase 2147483647
2018-08-08 14:16:43 INFO  s.d.s.w.p.DocumentationPluginsBootstrapper - Context refreshed
2018-08-08 14:16:43 INFO  s.d.s.w.p.DocumentationPluginsBootstrapper - Context refreshed
2018-08-08 14:16:43 INFO  s.d.s.w.p.DocumentationPluginsBootstrapper - Found 1 custom documentation plugin(s)
2018-08-08 14:16:43 INFO  s.d.s.w.p.DocumentationPluginsBootstrapper - Found 1 custom documentation plugin(s)
2018-08-08 14:16:43 INFO  s.d.s.w.s.ApiListingReferenceScanner - Scanning for api listing references
2018-08-08 14:16:43 INFO  s.d.s.w.s.ApiListingReferenceScanner - Scanning for api listing references
2018-08-08 14:16:43 INFO  o.a.coyote.http11.Http11NioProtocol - Starting ProtocolHandler ["http-nio-8080"]
2018-08-08 14:16:43 INFO  o.a.tomcat.util.net.NioSelectorPool - Using a shared selector for servlet write/read
2018-08-08 14:16:44 INFO  o.s.b.w.e.tomcat.TomcatWebServer - Tomcat started on port(s): 8080 (http) with context path ''
2018-08-08 14:16:44 INFO  c.i.c.c.c.s.BlueCostSpreadsheetUploadWebApplication - Started BlueCostSpreadsheetUploadWebApplication in 10.194 seconds (JVM running for 11.014)

共有1个答案

陆俊捷
2023-03-14

它的工作如预期,但我一直试图通过这些网址是不正确的。我在spring文档中找到了真正的URL,对我来说,它们是:

http://localhost:8080/actuator和http://localhost:8080/browser.html

 类似资料:
  • 我想禁用除健康endpoint之外的所有执行器endpoint。所有文档都描述了如何在资源属性中实现这一点: 但我一直倾向于使用内联java配置。有人能解释一下我可以在应用程序的什么地方配置相同的吗?

  • 我有一个带有Spring Security微服务的Spring Boot 2,我已使用米计/Spring Actuator配置了该微服务。当我在antMatcher("/驱动器/**")endpoint上permitAll()时,一切都很好。我能够通过正确配置的Prometheus yaml文件检索Prometheus指标。 但是,我的微服务不在防火墙后面,因此对世界开放。我只希望普罗米修斯能够访

  • 在我的Spring Boot应用程序(2.0.0.M7)中。我设置的属性 然而,当我击中 我得到404。 解决办法是什么?

  • 我正在尝试使用现有的Gradle Spring MVC项目设置Spring执行器。我无法使用@EnableAutoConfiguration。不幸的是,我无法到达执行器endpoint,我想我遗漏了一些东西。 项目中的Spring依赖项包括: 我正在尝试使用以下内容配置project: 在属性文件中,我添加了: 没有启用执行器endpoint,当尝试访问它们时,我得到404。我经历了许多相关问题,

  • 问题内容: 我一直在研究Spring / Spring MVC应用程序,并且希望添加性能指标。我遇到过Spring Boot Actuator,它看起来是一个不错的解决方案。但是我的应用程序不是Spring Boot应用程序。我的应用程序在传统容器Tomcat 8中运行。 我添加了以下依赖 我创建了以下配置类。 我什至可以按照StackOverflow另一篇文章的建议在每个配置类上添加 问题答案:

  • 我已经阅读了一些文档,并了解了如何使用执行器设置就绪性和活动性endpoint,比如这一个。但我不知道如何设置“启动”探测器的endpoint。 我的应用yml: 我的部署配置: 致动器似乎没有为“启动”探针提供URL,或者换句话说,http://localhost:8080/actuator/health/startup没用。我怎么设置呢?