根据this post的说法,通过在pom.xml中使用spring-boot-actuator依赖项,我可以从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。我在pom.xml中注释掉了上面的dependency。现在,我的应用程序为上述请求返回200 OK。
如果出了什么问题,请帮我排除故障。我找不到任何明显的原因。
谢谢
发布于 2015-09-04 08:05:26
当我查看控制台中的spring日志时,我注意到了以下内容:WARN org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/mycontext/foo] in DispatcherServlet with name 'DispatcherServlet'。
因为我已经在Spring应用程序中配置了DispatcherServlet,所以不能使用spring-boot-actuator的auto-configure。
一旦我排除了该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>https://stackoverflow.com/questions/32383875
复制相似问题