简体   繁体   English

application.properties 文件未被读取

[英]application.properties file not being read

I am trying to run an application on spring boot,i have mentioned server.port as 8081 but my application still runs on 8080.In fact it is not applying anything that i have mentioned on application.properties.我正在尝试在 spring 启动时运行应用程序,我提到 server.port 为 8081,但我的应用程序仍在 8080 上运行。事实上,它没有应用我在 application.properties 中提到的任何内容。 My application.properties file is:我的 application.properties 文件是:

spring.data.mongodb.uri=mongodb+srv://admin:admin@cluster0.r0sdgoq.mongodb.net/test
spring.data.mongodb.database=Cluster0
logging.file.name=filename.log
server.error.include-message = always
server.port=8081
library.url=http://localhost:8082/library/
spring.data.elasticsearch.cluster-name=my-application
spring.data.elasticsearch.cluster-nodes=localhost:9300
spring.kafka.consumer.bootstrap-servers=localhost:9092
spring.kafka.consumer.group-id=myGroup
spring.kafka.consumer.auto-offset-reset=earliest
spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer
spring.kafka.consumer.value-deserializer=org.springframework.kafka.support.serializer.JsonDeserializer

spring.kafka.producer.bootstrap-servers=localhost:9092
spring.kafka.producer.key-serializer=org.apache.common.serialization.StringSerializer
spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer

but in the console it says its running on 8080但在控制台中它说它在 8080 上运行

2022-11-23 16:53:33.413  INFO 11380 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)

I initially thought i was running the wrong project but it is the same project.i tried giving different ports but it still runs on 8080.I even deleted the application.properties file and created it again but it still run on 8080我最初以为我运行了错误的项目,但它是同一个项目。我尝试提供不同的端口,但它仍然在 8080 上运行。我什至删除了 application.properties 文件并重新创建它,但它仍然在 8080 上运行

Try checking the directory on which your application.properties file is located.尝试检查您的 application.properties 文件所在的目录。 It is supposed to be under src\main\resources它应该在src\main\resources

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM