0

根据这篇文章,通过spring-boot-actuator依赖 in ,我可以从端点中pom.xml受益。actuator但是,我观察到它破坏了我现有的 spring 应用程序(它不是 spring-boot 应用程序)。

我在 pom.xml 中将以下内容添加到我的依赖项中

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

而已。我还没有对应用程序进行任何更改。我使用maven-t7-plugin. 现在我的应用程序端点http://localhost:8010/mycontext/foo返回 404。我dependencypom.xml. 现在我的应用程序返回200 OK上述请求。

请帮助我解决问题所在。我找不到任何明显的原因。

谢谢

4

1 回答 1

0

当我查看控制台中的 spring 日志时,我注意到以下内容 WARN org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/mycontext/foo] in DispatcherServlet with name 'DispatcherServlet'

由于我在 Spring 应用程序中进行了配置,DispatcherServlet因此无法使用auto-configure.spring-boot-actuator

一旦我排除了它dependency,我的应用程序就会按预期工作。

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-actuator</artifactId>
    <version>1.2.5.RELEASE</version>
    <exclusions>
        <exclusion>
            <groupId>org.springframework.boot</groupId> 
            <artifactId>spring-boot-autoconfigure</artifactId>
        </exclusion>
    </exclusions>
</dependency>
于 2015-09-04T00:05:25.740 回答