Spring Boot Local Development Guide
Run Java Web applications and REST APIs on localhost:8080 using Spring Boot, with support for hot reloading via devtools.
Spring Boot is the most popular web and microservices framework in the Java ecosystem, with embedded Tomcat/Jetty. By default, it runs locally at http://localhost:8080.
Quick Start
Generate a project using Spring Initializr, or:
# Requires JDK 17+ and Maven/Gradle
./mvnw spring-boot:run
# or
./gradlew bootRunAccess http://localhost:8080.
Change Port
In src/main/resources/application.properties:
server.port=8081Or in application.yml:
server:
port: 8081Common localhost Paths
| Path | Description |
|---|---|
/ | Home page or API root |
/actuator/health | Health check (requires actuator) |
/h2-console | Embedded H2 console (if enabled) |
Local Database
For development, use the H2 in-memory database or connect to a local MySQL/PostgreSQL:
spring.datasource.url=jdbc:postgresql://localhost:5432/mydb
spring.datasource.username=postgres
spring.datasource.password=secretDevTools Hot Reload
After including spring-boot-devtools, code changes will automatically restart (for resources in the classpath).
Frequently Asked Questions
Port 8080 is occupied by Tomcat/other Java services
Change server.port or stop other services.
Slow builds
The first dependency download may be slow; consider using a domestic Maven mirror.
Summary
Spring Boot defaults to http://localhost:8080, making it the standard localhost entry point for Java backends and REST APIs.