【问题标题】:spring-boot runs on port 8080 after mvn clean install在 mvn clean install 之后 spring-boot 在端口 8080 上运行
【发布时间】:2020-07-29 12:32:47
【问题描述】:

我正在使用 Spring Boot 运行一个 Web 应用程序。 当我运行./mvnw spring-boot:run 时,应用程序在application.properties 文件中配置的端口8083 上运行。但如果我运行./mvnw clean install 然后./mvnw spring-boot:run,应用程序在默认端口8080 上运行。

有什么线索吗?

这是我的 Maven 配置文件

https://drive.google.com/file/d/13XOy_iu2zMQx7ohD5x0HS78PcEWjbIry/view?usp=sharing

【问题讨论】:

  • 你检查了maven插件配置了吗?也许 maven 安装目标不包括属性文件。可以分享一下 pom.xml 吗?
  • 我附上了 pom.xml

标签: spring-boot maven


【解决方案1】:

看起来 application.properties 没有加载,因为 pom.xml 中没有配置资源文件夹。

我将此添加到我的 pom.xml 文件中:

    `<resources>
        <resource>
            <directory>res</directory>
        </resource>
    </resources>`

【讨论】:

    猜你喜欢
    • 2016-11-11
    • 2016-07-27
    • 2013-11-16
    • 2021-04-23
    • 1970-01-01
    • 1970-01-01
    • 2019-06-16
    • 2020-03-23
    • 2023-03-17
    相关资源
    最近更新 更多