Spring Boot Configure Server Port and Context Path - Java @ Desk

Friday, March 23, 2018

Spring Boot Configure Server Port and Context Path

Spring Boot Configure Server Port and Context Path

By default, in Spring Boot the context path is "/" and server port is 8080.

In order to configure the context path or server port, application.properties need to be configured.

applicatin.properties is located in src/main/resources folder. Following entries are required to configure.

server.port=8088
server.contextPath=/myContectPath

There is one more way to update the context path while running the application from command line. Below is the code for the same -

java -jar -Dserver.contextPath=/myContectPath mySpringBoot.jar





No comments:

Post a Comment