Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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