Skip to main content

Documentation Index

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

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

Spring Boot’s externalized configuration system lets you tune nearly every aspect of your application without touching source code. Properties can be set in application.properties, application.yaml, environment variables, command-line arguments, or any of the other supported property sources — and Spring Boot applies them in a well-defined precedence order, with later sources overriding earlier ones. Relaxed binding means spring.datasource.url, SPRING_DATASOURCE_URL, and spring.datasource.url are all equivalent, giving you flexibility across deployment environments.
Property contributions can come from additional jar files on your classpath, so this is not an exhaustive list. You can also define your own properties using @ConfigurationProperties. See the external configuration documentation for full details on type-safe configuration and value conversion.
Spring Boot provides advanced value formatting for durations (10s, 5m), data sizes (10MB, 512KB), and other types. Make sure to review the externalized configuration guide for details on Duration, DataSize, and other conversion types.

Property source precedence

When the same property is set in multiple locations, Spring Boot applies them in the following order (higher numbers override lower numbers):
  1. Default properties (SpringApplication.setDefaultProperties)
  2. @PropertySource annotations on @Configuration classes
  3. Config files (application.properties / application.yaml)
  4. RandomValuePropertySource
  5. OS environment variables
  6. Java system properties (-Dkey=value)
  7. JNDI attributes from java:comp/env
  8. ServletContext init parameters
  9. ServletConfig init parameters
  10. Properties from SPRING_APPLICATION_JSON
  11. Command-line arguments (--key=value)
  12. Test properties and @TestPropertySource
# Properties file format
spring.application.name=my-app
server.port=8080

Property groups

Core properties control the fundamental behavior of the Spring application context and application startup.
PropertyTypeDefaultDescription
spring.application.nameStringApplication name, used in logging, metrics, and distributed tracing.
spring.main.banner-modeBannerModeconsoleMode for printing the Spring Boot banner (console, log, off).
spring.main.lazy-initializationbooleanfalseWhether to initialize beans lazily. Reduces startup time but delays error detection.
spring.main.web-application-typeWebApplicationTypeauto-detectedForce the application type (none, servlet, reactive).
spring.main.allow-bean-definition-overridingbooleanfalseWhether to allow bean definition overriding.
spring.profiles.activeList<String>Comma-separated list of active profiles.
spring.profiles.includeList<String>Additional profiles to always activate, regardless of other profile settings.
spring.config.importList<String>Additional config files or locations to import (e.g., optional:file:./extra.properties).
spring:
  application:
    name: payment-service
  main:
    lazy-initialization: true
    banner-mode: "off"
  profiles:
    active: production
Server properties configure the embedded web server (Tomcat, Jetty, or Undertow) including port, SSL, HTTP/2, compression, and shutdown behavior.
PropertyTypeDefaultDescription
server.portInteger8080Server HTTP port. Use 0 to let the OS assign a random port.
server.addressInetAddressNetwork address to bind the server to.
server.shutdownShutdownimmediateShutdown type: immediate or graceful.
server.servlet.context-pathStringContext path for the application.
server.ssl.enabledbooleanfalseWhether to enable SSL support.
server.ssl.key-storeResourcePath to the key store holding the SSL certificate.
server.ssl.key-store-passwordStringPassword for the key store.
server.ssl.key-store-typeStringType of the key store (PKCS12, JKS).
server.ssl.certificateResourcePEM-encoded SSL certificate file path (alternative to key store).
server.ssl.certificate-private-keyResourcePEM-encoded private key file path.
server.http2.enabledbooleanfalseWhether to enable HTTP/2 support (requires SSL or h2c).
server.compression.enabledbooleanfalseWhether response compression is enabled.
server.compression.mime-typesList<String>text/html, text/xml, …MIME types that should be compressed.
server.compression.min-response-sizeDataSize2KBMinimum response size that triggers compression.
server.error.include-messageIncludeAttributeneverWhether to include the exception message in error responses.
server.port=8443
server.ssl.enabled=true
server.ssl.key-store=classpath:keystore.p12
server.ssl.key-store-password=changeit
server.ssl.key-store-type=PKCS12
server.http2.enabled=true
Graceful shutdown (server.shutdown=graceful) waits for active requests to complete before stopping. Set spring.lifecycle.timeout-per-shutdown-phase to control the maximum wait time (default: 30s).
Logging properties control log levels, output destinations, and pattern formatting. Spring Boot defaults to Logback but also supports Log4j2.
PropertyTypeDefaultDescription
logging.level.*Map<String, Level>Log levels per logger. Key is the logger name (package or class); use root for the root logger.
logging.file.nameStringLog file name (e.g., app.log or /var/log/app.log).
logging.file.pathStringDirectory for the log file. Creates spring.log in that directory.
logging.pattern.consoleStringLogback pattern for console output.
logging.pattern.fileStringLogback pattern for file output.
logging.pattern.dateformatStringyyyy-MM-dd'T'HH:mm:ss.SSSXXXDate format for log timestamps.
logging.logback.rollingpolicy.file-name-patternStringFilename pattern for rolled log archives.
logging.logback.rollingpolicy.max-file-sizeDataSize10MBMaximum size of a log file before rollover.
logging.logback.rollingpolicy.max-historyint7Maximum number of archived log files to keep.
logging.logback.rollingpolicy.total-size-capDataSize0BTotal cap on log archive size (0 means unlimited).
logging.charset.consoleCharsetCharacter set for console output.
logging.structured.format.consoleStringStructured logging format for console (ecs, logstash, gelf).
logging:
  level:
    root: warn
    org.springframework.web: info
    com.example.myapp: debug
  file:
    name: /var/log/my-app.log
  logback:
    rollingpolicy:
      max-file-size: 20MB
      max-history: 30
You can also set log levels at runtime without restarting by using the Actuator /actuator/loggers endpoint when logging.level.* changes are exposed.
DataSource properties configure the connection pool and JDBC URL. Spring Boot auto-configures HikariCP by default when it is on the classpath.
PropertyTypeDefaultDescription
spring.datasource.urlStringJDBC URL of the database.
spring.datasource.usernameStringLogin username of the database.
spring.datasource.passwordStringLogin password of the database.
spring.datasource.driver-class-nameStringauto-detectedJDBC driver class name. Usually inferred from the URL.
spring.datasource.typeClassFully qualified name of the connection pool implementation.
spring.datasource.hikari.pool-nameStringHikariCP pool name.
spring.datasource.hikari.minimum-idleint10Minimum number of idle connections in the pool.
spring.datasource.hikari.maximum-pool-sizeint10Maximum size the pool can reach.
spring.datasource.hikari.connection-timeoutlong30000Maximum milliseconds to wait for a connection from the pool.
spring.datasource.hikari.idle-timeoutlong600000Maximum milliseconds a connection can sit idle (10 minutes).
spring.datasource.hikari.max-lifetimelong1800000Maximum lifetime in milliseconds of a connection in the pool.
spring.datasource.hikari.connection-test-queryStringSQL query to validate connections (use isValid() instead when possible).
spring.datasource.url=jdbc:postgresql://localhost:5432/mydb
spring.datasource.username=appuser
spring.datasource.password=secret
spring.datasource.hikari.maximum-pool-size=20
spring.datasource.hikari.minimum-idle=5
JPA properties configure Hibernate behavior, DDL generation, and query logging. These map to both Spring Data JPA settings and Hibernate properties.
PropertyTypeDefaultDescription
spring.jpa.hibernate.ddl-autoStringauto-detectedDDL mode: none, validate, update, create, create-drop.
spring.jpa.show-sqlbooleanfalseWhether to log SQL statements. Prefer setting logging.level.org.hibernate.SQL=debug.
spring.jpa.format-sqlbooleanfalseWhether to format SQL output (requires show-sql=true).
spring.jpa.open-in-viewbooleantrueWhether to bind a JPA EntityManager to the thread for the entire request lifecycle.
spring.jpa.generate-ddlbooleanfalseWhether to initialize the schema on startup (database-agnostic alternative to ddl-auto).
spring.jpa.database-platformStringauto-detectedHibernate dialect class name.
spring.jpa.properties.*Map<String, String>Additional native Hibernate properties (e.g., spring.jpa.properties.hibernate.cache.use_second_level_cache=true).
spring:
  jpa:
    hibernate:
      ddl-auto: validate
    show-sql: false
    open-in-view: false
    properties:
      hibernate:
        jdbc:
          batch_size: 50
        order_inserts: true
spring.jpa.open-in-view=true (the default) keeps a database connection open for the entire HTTP request, including view rendering. Disable it in production to avoid connection pool exhaustion.
Actuator properties control which endpoints are exposed, how health details are displayed, and how the management server is configured.
PropertyTypeDefaultDescription
management.endpoints.web.exposure.includeSet<String>healthEndpoint IDs to expose over HTTP. Use * to expose all.
management.endpoints.web.exposure.excludeSet<String>Endpoint IDs to exclude from HTTP exposure.
management.endpoints.web.base-pathString/actuatorBase path for web endpoints.
management.endpoint.health.show-detailsShowDetailsneverWhen to show full health component details: never, when-authorized, always.
management.endpoint.health.show-componentsShowComponentsneverWhen to show individual health components.
management.endpoint.health.probes.enabledbooleanfalseWhether to enable liveness and readiness probes.
management.server.portIntegerPort for the management HTTP server (isolates actuator from app traffic).
management.server.addressInetAddressNetwork address to bind the management server to.
management.info.env.enabledbooleanfalseWhether to expose env info contributor properties.
management.endpoints.web.exposure.include=health,info,metrics,loggers
management.endpoint.health.show-details=when-authorized
management.endpoint.health.probes.enabled=true
Security properties configure the default in-memory user (for development), OAuth2, and SAML2 integration.
PropertyTypeDefaultDescription
spring.security.user.nameStringuserDefault in-memory user name (for development only).
spring.security.user.passwordStringrandomly generatedDefault in-memory user password (printed to the log on startup).
spring.security.user.rolesList<String>Roles granted to the default in-memory user.
spring.security.filter.orderint-100Order of the security filter chain.
spring.security.oauth2.client.registration.*MapOAuth2 / OpenID Connect client registration properties.
spring.security.oauth2.resourceserver.jwt.issuer-uriStringURI of the JWT issuer for resource server validation.
spring.security.oauth2.resourceserver.jwt.jwk-set-uriStringURI of the JWK Set endpoint.
spring:
  security:
    user:
      name: admin
      password: changeme
      roles:
        - ADMIN
    oauth2:
      resourceserver:
        jwt:
          issuer-uri: https://auth.example.com
The spring.security.user.name and spring.security.user.password properties are intended for development and testing only. In production, replace the in-memory UserDetailsService with a proper authentication provider.

Build docs developers (and LLMs) love