gpt4 book ai didi

java - Spring Boot 应用程序不使用 Application.Properties 文件

转载 作者:行者123 更新时间:2023-12-01 19:33:15 41 4
gpt4 key购买 nike

我是 Spring Boot 新手,开始探索 Spring Boot。根据我阅读的类(class)和文档,Spring Boot 将自动获取 application.properties。我的 Application.properties 中有以下值

**Application.Properties**
server.port = 9000
server.servlet.context-path=/bharathi

但是,在 JBOSS 中部署时,服务器端口是从standalone.xml 中获取的,它指向 8085。上下文路径也是根据 war 文件自动生成的。

14:04:52,579 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0006: Undertow HTTP listener default listening on 127.0.0.1:8085
.
.
.
14:05:20,388 INFO [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 83) Initializing Mojarra 2.3.5.SP2-redhat-00001 for context '/ou-0.0.1-SNAPSHOT'

我不确定我在这里做错了什么,但有些事情是错误的。谁能帮我解决这个问题吗?

最佳答案

服务器端口=9000

这仅适用于嵌入式 tomcat 服务器 - 例如,当使用 SpringBoot 并像任何其他 java 应用程序一样运行时。

在部署服务器上,端口与服务器或部署描述符中的配置相同。

关于java - Spring Boot 应用程序不使用 Application.Properties 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58866200/

41 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com