How to configure port for Spring Boot application in application.properties
Hello everyone! I'm new to Spring Boot and trying to run my first web application. By default it runs on port 8080, but I need to change the port to, for example, 9090, because port 8080 is already occupied by another service.
I created the `application.properties` file in the `src/main/resources` folder, but nothing happens. Here is my file:
```java
// application.properties
server.port = 9090
```
I restarted the application, but it still starts on 8080. What am I doing wrong? Do I need to add some annotations to the main class? Or change the project structure? I also tried passing the port via command line using `--server.port=9090`, but that didn't work either.
I also noticed that the logs say: "Tomcat started on port(s): 8080 (http)". There are no errors. I'm using
No answers yet.
Log in to leave an answer
Blogs