简体   繁体   中英

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. My application.properties file is:

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

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

Try checking the directory on which your application.properties file is located. It is supposed to be under src\main\resources

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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