Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ricpalomino/spring-boot/llms.txt

Use this file to discover all available pages before exploring further.

The Spring Boot Products API reads all its runtime configuration from src/main/resources/application.properties. Spring Boot’s externalized configuration system means you can override any property through environment variables, JVM flags, or profile-specific property files without touching the packaged artifact. The sections below walk through each property group and explain how to adapt them for your environment.

Full application.properties

The file ships with sensible defaults that work out of the box on a local machine:
spring.application.name=demo

# Logging Configuration
logging.level.root=INFO
logging.level.com.zegel.springboot=DEBUG
logging.level.org.springframework.web=INFO

# Log output format
logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} - %msg%n
logging.pattern.file=%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %X{traceId} - %msg%n

# File logging
logging.file.name=logs/application.log
logging.file.max-size=10MB
logging.file.max-history=10
logging.file.total-size-cap=100MB

Application name

PropertyValue
spring.application.namedemo
Spring Boot uses this name in log output, metrics exports, and distributed tracing headers. Update it to match your deployment name before going to production.

Logging levels

These three properties control how verbose each package’s output is:
PropertyDefaultDescription
logging.level.rootINFOBaseline level for all packages not matched by a more specific rule
logging.level.com.zegel.springbootDEBUGFull debug output for application code
logging.level.org.springframework.webINFOSpring MVC request mapping and dispatcher logs
Set any level to WARN or ERROR in production to reduce noise. See the logging guide for per-package overrides at runtime.

Log output patterns

PropertyPattern
logging.pattern.console%d{yyyy-MM-dd HH:mm:ss} - %msg%n
logging.pattern.file%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %X{traceId} - %msg%n
The file pattern includes %X{traceId}, a value written to the SLF4J MDC by LoggingInterceptor at the start of each HTTP request. This lets you filter all log lines for a single request by its trace ID.

File logging and rotation

PropertyValueDescription
logging.file.namelogs/application.logPath to the active log file, relative to the working directory
logging.file.max-size10MBMaximum size of a single log file before rotation
logging.file.max-history10Number of rotated files to keep
logging.file.total-size-cap100MBHard cap on total disk usage across all rotated files
When logs/application.log reaches 10 MB, Logback renames it with a date-and-index suffix (e.g., application-2026-05-19.0.log) and opens a fresh file. Older files are deleted once the archive crosses 100 MB.
The application listens on port 8080 by default. To use a different port, add server.port=9090 (or your preferred value) to application.properties, or pass -Dserver.port=9090 on the command line.

Spring profiles

You can create environment-specific overrides without modifying the base file. Spring Boot automatically loads application-{profile}.properties alongside application.properties when a profile is active, with the profile file taking precedence.
1

Create a profile file

Add src/main/resources/application-prod.properties with only the properties you want to override:
logging.level.root=WARN
logging.level.com.zegel.springboot=INFO
logging.file.name=/var/log/products/application.log
2

Activate the profile

Pass the profile name when starting the application:
./mvnw spring-boot:run -Dspring-boot.run.profiles=prod
Or as a JVM flag on a packaged JAR:
java -Dspring.profiles.active=prod -jar target/demo-0.0.1-SNAPSHOT.jar
Common profile names are dev, test, and prod, but you can use any name that makes sense for your workflow.
Add Spring Boot DevTools to your pom.xml during development to get automatic application restart whenever you change a class or resource file. DevTools is already included in this project’s dependencies—just run ./mvnw spring-boot:run and edit files normally. DevTools is automatically disabled when running a packaged JAR, so it never reaches production.

Build docs developers (and LLMs) love