Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Spring Basics Spring Components and Configuring Our App Adding a Spring Configuration File

Vaibhav Yaramwar
PLUS
Vaibhav Yaramwar
Courses Plus Student 4,292 Points

How to change localhost port

My Localhost port 8080 is already in used by System or By Some other Application....Now I want to change my local host port for Tomcat .... how should I do it in Spring Boot?

2 Answers

Daniel Vargas
Daniel Vargas
29,184 Points

Hi,

In the application.properties you can change spring default values, in the case of the port you could do this:

server.port = 8000
Vaibhav Yaramwar
Vaibhav Yaramwar
Courses Plus Student 4,292 Points

Hi Daniel Thanks For Your Answer but in my Project I am not able to locate this file.

Daniel Vargas
Daniel Vargas
29,184 Points

You can create the file application.proterties in the resources folder, spring-boot will find it.

Also here are some other properties you could change in that file:

https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html