Reputation: 188
I have a springboot application which i want to deploy in tomcat . i followed the instructions here I have application.properties file in src/main/resources with following entries
server.context-path=/mycontext
server.port=9000
I can see that those properties are loaded from actuator urls.
applicationConfig: [classpath:application.properties]": {
"server.port": "9000",
"server.context-path": "/mycontext"}
it works fine when i run it as an executable jar but when i deploy to tomcat it still listens to 8080 port and context value is not updated instead it falls back to application folder name. Please let me know if i have missed something . Thanks in advance.
Upvotes: 4
Views: 7184
Reputation: 188
server.* config values in application.properties only apply to embedded server. External container by default uses the application name as the context root as mentioned here
Upvotes: 2
Reputation: 2442
By default,
Tomcat listens in port 8080 and when you have deployed the war in tomcat it also listen on port 8080, this can't change the listening port of tomcat.
The application.properties
file is the configuration of your springboot project but it is not for the tomcat.
There is a builtin tomcat in springboot project. When you change its configuration in application.properties
file, it will change the configuration of builtin tomcat automatically.
If you want to deploy your project to tomcat and listen on port 9000 then you need to change the configuration file of your tomcat (Changing listening port from 8080
to 9000
).
N.B. : Springboot project provides us with smart deploying technique with just a command. If you use springboot project then it is unnecessary to use another tomcat for deployment.
Upvotes: 4