Spring Boot provides sensible defaults for many configuration properties. But we sometimes need to customize these with our case-specific values. And a common use case is changing the default port for the embedded server.
To change the default port we can use the application.properties file :
server.port=8081
Or we can use the application.yml file :
server: port : 8081
Here we changed the default Tomcat port 8080 to 8081. We can use a Java configuration to change the default port .