首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用spring-boot-actuator会改变spring应用程序的上下文根吗?

使用spring-boot-actuator会改变spring应用程序的上下文根吗?
EN

Stack Overflow用户
提问于 2015-09-04 03:23:52
回答 1查看 1.3K关注 0票数 0

根据this post的说法,通过在pom.xml中使用spring-boot-actuator依赖项,我可以从actuator端点中获益。然而,我观察到它破坏了我现有的我的spring应用程序(它不是spring-boot应用程序)。

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

代码语言:javascript
复制
      <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

如果出了什么问题,请帮我排除故障。我找不到任何明显的原因。

谢谢

EN

回答 1

Stack Overflow用户

发布于 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-actuatorauto-configure

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

代码语言:javascript
复制
<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>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32383875

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档