Created
October 10, 2025 17:26
-
-
Save simonespa/b36e2d0896b562404fe72682b7e326a2 to your computer and use it in GitHub Desktop.
Spring Boot example application.yaml file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Server port configuration | |
| server: | |
| port: 8080 | |
| servlet: | |
| context-path: /api # Base path for all endpoints | |
| error: | |
| include-message: always # Include error messages in responses for debugging purposes | |
| include-binding-errors: always # Include binding errors in responses for debugging purposes | |
| whitelabel: | |
| enabled: false # Disable default whitelabel error page | |
| compression: | |
| enabled: true # Enable response compression | |
| mime-types: application/json,application/xml,text/html,text/xml,text/plain # MIME types to compress | |
| min-response-size: 1024 # Minimum response size to trigger compression (in bytes) | |
| tomcat: | |
| max-threads: 200 # Maximum number of threads for handling requests | |
| min-spare-threads: 20 # Minimum number of spare threads | |
| connection-timeout: 20000 # Connection timeout in milliseconds | |
| max-connections: 10000 # Maximum number of connections to accept | |
| accept-count: 100 # Maximum queue length for incoming connection requests | |
| keep-alive-timeout: 15000 # Keep-alive timeout in milliseconds | |
| max-keep-alive-requests: 100 # Maximum number of requests to be served over a single keep-alive connection | |
| jetty: | |
| max-threads: 200 | |
| min-threads: 20 | |
| acceptors: 2 | |
| selectors: 4 | |
| idle-timeout: 30000 | |
| undertow: | |
| io-threads: 4 | |
| worker-threads: 20 | |
| buffers: | |
| direct-buffers: true | |
| buffer-size: 10244 | |
| buffers-per-region: 1024 | |
| max-parameters: 1000 | |
| max-headers: 200 | |
| max-cookies: 200 | |
| max-chunk-size: 8192 | |
| max-buffered-request-size: 16384 | |
| max-entity-size: 10485760 # 10 MB | |
| accesslog: | |
| enabled: true | |
| pattern: "%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" | |
| directory: logs | |
| prefix: access_log | |
| suffix: .log | |
| rotate: true | |
| extended: false | |
| locale: en_US | |
| timezone: GMT | |
| servlet: | |
| session: | |
| timeout: 30m # Session timeout duration | |
| tracking-modes: cookie # Session tracking modes | |
| cookie: | |
| http-only: true # HttpOnly flag for session cookies | |
| secure: true # Secure flag for session cookies | |
| name: SESSIONID # Custom name for session cookie | |
| # Logging configuration | |
| logging: | |
| level: | |
| root: INFO # Default logging level | |
| com.example: DEBUG # Specific logging level for application packages | |
| file: | |
| name: logs/application.log # Log file location | |
| max-size: 10MB # Maximum size of log file before rotation | |
| max-history: 30 # Number of days to keep log files | |
| pattern: | |
| console: "%d{yyyy-MM-dd HH:mm:ss} - %msg%n" # Console log pattern | |
| file: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n" # File log pattern | |
| logback: | |
| rollingpolicy: | |
| file-name-pattern: logs/application-%d{yyyy-MM-dd}.%i.log.gz # Rolling policy for log files | |
| max-file-size: 10MB # Maximum size of each log file | |
| max-history: 30 # Number of days to keep log files | |
| total-size-cap: 1GB # Total size cap for all log files | |
| logstash: | |
| enabled: false # Enable or disable Logstash logging | |
| host: localhost # Logstash host | |
| port: 5000 # Logstash port | |
| queue-size: 512 # Queue size for Logstash appender | |
| custom-fields: '{"app":"music-api","env":"dev"}' # Custom fields to include in Logstash logs | |
| metrics: | |
| enabled: true # Enable or disable metrics logging | |
| export: prometheus # Export metrics in Prometheus format | |
| prometheus: | |
| endpoint: /actuator/prometheus # Endpoint for Prometheus metrics | |
| graphite: | |
| host: localhost # Graphite host | |
| port: 2003 # Graphite port | |
| prefix: music-api # Prefix for Graphite metrics | |
| influxdb: | |
| url: http://localhost:8086 # InfluxDB URL | |
| db: metrics # InfluxDB database name | |
| user: admin # InfluxDB username | |
| password: admin # InfluxDB password | |
| retention-policy: autogen # InfluxDB retention policy | |
| step: 1m # Step interval for metrics collection | |
| batch-size: 100 # Batch size for sending metrics to InfluxDB | |
| flush-interval: 10s # Flush interval for sending metrics to InfluxDB | |
| audit: | |
| enabled: true # Enable or disable audit logging | |
| file: | |
| name: logs/audit.log # Audit log file location | |
| max-size: 10MB # Maximum size of audit log file before rotation | |
| max-history: 30 # Number of days to keep audit log files | |
| pattern: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n" # Audit log pattern | |
| filter: | |
| enabled: true # Enable or disable log filtering | |
| level: WARN # Minimum log level to filter | |
| packages: | |
| - org.springframework.web # Packages to filter logs from | |
| - org.hibernate # Packages to filter logs from | |
| exclude: | |
| - com.example.noisy # Specific classes to exclude from filtering | |
| - com.example.debug # Specific classes to exclude from filtering | |
| include: | |
| enabled: true # Enable or disable log inclusion | |
| level: DEBUG # Minimum log level to include | |
| packages: | |
| - com.example.service # Packages to include logs from | |
| - com.example.controller # Packages to include logs from | |
| exclude: | |
| - com.example.verbose # Specific classes to exclude from inclusion | |
| - com.example.trace # Specific classes to exclude from inclusion | |
| async: | |
| enabled: true # Enable or disable asynchronous logging | |
| queue-size: 1024 # Size of the async logging queue | |
| discard-threshold: 0 # Threshold for discarding log events when the queue is full | |
| include-location: false # Include location information in async logs | |
| appender-ref: FILE # Reference to the appender to use for async logging | |
| spring: | |
| boot: | |
| logging: | |
| logback: | |
| debug: false # Enable or disable Logback debug mode | |
| level: | |
| org.springframework: INFO # Default logging level for Spring framework | |
| org.hibernate: WARN # Default logging level for Hibernate | |
| com.example: DEBUG # Default logging level for application packages | |
| file: | |
| name: logs/spring-boot.log # Spring Boot log file location | |
| max-size: 10MB # Maximum size of Spring Boot log file before rotation | |
| max-history: 30 # Number of days to keep Spring Boot log files | |
| pattern: | |
| console: "%d{yyyy-MM-dd HH:mm:ss} - %msg%n" # Spring Boot console log pattern | |
| file: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n" # Spring Boot file log pattern | |
| logstash: | |
| enabled: false # Enable or disable Spring Boot Logstash logging | |
| host: localhost # Spring Boot Logstash host | |
| port: 5000 # Spring Boot Logstash port | |
| queue-size: 512 # Spring Boot Logstash queue size | |
| custom-fields: '{"app":"music-api","env":"dev"}' # Spring Boot Logstash custom fields | |
| metrics: | |
| enabled: true # Enable or disable Spring Boot metrics logging | |
| export: prometheus # Spring Boot metrics export format | |
| prometheus: | |
| endpoint: /actuator/prometheus # Spring Boot Prometheus metrics endpoint | |
| graphite: | |
| host: localhost # Spring Boot Graphite host | |
| port: 2003 # Spring Boot Graphite port | |
| prefix: music-api # Spring Boot Graphite metrics prefix | |
| influxdb: | |
| url: http://localhost:8086 # Spring Boot InfluxDB URL | |
| db: metrics # Spring Boot InfluxDB database name | |
| user: admin # Spring Boot InfluxDB username | |
| password: admin # Spring Boot InfluxDB password | |
| retention-policy: autogen # Spring Boot InfluxDB retention policy | |
| step: 1m # Spring Boot InfluxDB step interval | |
| batch-size: 100 # Spring Boot InfluxDB batch size | |
| flush-interval: 10s # Spring Boot InfluxDB flush interval | |
| audit: | |
| enabled: true # Enable or disable Spring Boot audit logging | |
| file: | |
| name: logs/spring-audit.log # Spring Boot audit log file location | |
| max-size: 10MB # Maximum size of Spring Boot audit log file before rotation | |
| max-history: 30 # Number of days to keep Spring Boot audit log files | |
| pattern: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n" # Spring Boot audit log pattern | |
| filter: | |
| enabled: true # Enable or disable Spring Boot log filtering | |
| level: WARN # Minimum log level to filter in Spring Boot | |
| packages: | |
| - org.springframework.web # Packages to filter logs from in Spring Boot | |
| - org.hibernate # Packages to filter logs from in Spring Boot | |
| exclude: | |
| - com.example.noisy # Specific classes to exclude from filtering in Spring Boot | |
| - com.example.debug # Specific classes to exclude from filtering in Spring Boot | |
| include: | |
| enabled: true # Enable or disable Spring Boot log inclusion | |
| level: DEBUG # Minimum log level to include in Spring Boot | |
| packages: | |
| - com.example.service # Packages to include logs from in Spring Boot | |
| - com.example.controller # Packages to include logs from in Spring Boot | |
| exclude: | |
| - com.example.verbose # Specific classes to exclude from inclusion in Spring Boot | |
| - com.example.trace # Specific classes to exclude from inclusion in Spring Boot | |
| async: | |
| enabled: true # Enable or disable Spring Boot asynchronous logging | |
| queue-size: 1024 # Size of the Spring Boot async logging queue | |
| discard-threshold: 0 # Threshold for discarding log events when the Spring Boot queue is full | |
| include-location: false # Include location information in Spring Boot async logs | |
| appender-ref: FILE # Reference to the appender to use for Spring Boot async logging | |
| jackson: | |
| serialization: | |
| indent-output: true # Pretty-print JSON output | |
| deserialization: | |
| fail-on-unknown-properties: false # Ignore unknown properties during deserialization | |
| property-naming-strategy: SNAKE_CASE # Use snake_case for JSON properties | |
| date-format: com.fasterxml.jackson.databind.util.StdDateFormat # Standard date format for JSON | |
| default-property-inclusion: non_null # Exclude null properties from JSON output | |
| mapper: | |
| visibility: | |
| field: ANY # Include all fields in JSON serialization/deserialization | |
| getter: NONE # Exclude getters from JSON serialization/deserialization | |
| is-getter: NONE # Exclude is-getters from JSON serialization/deserialization | |
| setter: NONE # Exclude setters from JSON serialization/deserialization | |
| creator: NONE # Exclude creators from JSON serialization/deserialization | |
| modules: | |
| - com.fasterxml.jackson.datatype.jsr310.JavaTimeModule # Support for Java 8 date/time types | |
| - com.fasterxml.jackson.module.paramnames.ParameterNamesModule # Support for constructor parameter names | |
| - com.fasterxml.jackson.module.kotlin.KotlinModule # Support for Kotlin classes | |
| fail-on-empty-beans: false # Prevent failure on empty beans during serialization | |
| write-dates-as-timestamps: false # Write dates as ISO-8601 strings | |
| write-dates-with-zone-id: true # Include timezone information in date serialization | |
| write-duration-as-timestamps: false # Write durations as ISO-8601 strings | |
| write-timestamps-as-nanoseconds: false # Write timestamps with nanosecond precision | |
| read-dates-as-timestamps: false # Read dates from ISO-8601 strings | |
| read-durations-as-timestamps: false # Read durations from ISO-8601 strings | |
| read-timestamps-as-nanoseconds: false # Read timestamps with nanosecond precision | |
| polymorphic-type-handling: true # Enable polymorphic type handling | |
| json-views: true # Enable support for JSON views | |
| filter-provider: com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider # Default filter provider for JSON serialization | |
| injectable-values: com.fasterxml.jackson.databind.InjectableValues.Std # Default injectable values for JSON deserialization | |
| object-mapper: com.fasterxml.jackson.databind.ObjectMapper # Custom ObjectMapper bean name | |
| xml-mapper: com.fasterxml.jackson.dataformat.xml.XmlMapper # Custom XmlMapper bean name | |
| yaml-mapper: com.fasterxml.jackson.dataformat.yaml.YAMLMapper # Custom YAMLMapper bean name | |
| cbor-mapper: com.fasterxml.jackson.dataformat.cbor.CBORMapper # Custom CBORMapper bean name | |
| smile-mapper: com.fasterxml.jackson.dataformat.smile.SmileMapper # Custom Smile | |
| afterburner-mapper: com.fasterxml.jackson.module.afterburner.AfterburnerModule # Enable Afterburner module for performance | |
| parameter-names-mapper: com.fasterxml.jackson.module.paramnames.ParameterNamesModule # Enable | |
| jsr310-mapper: com.fasterxml.jackson.datatype.jsr310.JavaTimeModule # Enable JSR-310 module for Java 8 date/time types | |
| kotlin-mapper: com.fasterxml.jackson.module.kotlin.KotlinModule # Enable Kotlin module for | |
| joda-mapper: com.fasterxml.jackson.datatype.joda.JodaModule # Enable Joda-Time module | |
| guava-mapper: com.fasterxml.jackson.datatype.guava.GuavaModule # Enable | |
| hibernate5-mapper: com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module # Enable Hibernate 5 module | |
| hibernate5-2-mapper: com.fasterxml.jackson.datatype.hibernate5.Hibernate5 | |
| afterburner: true # Enable Afterburner module for performance | |
| parameter-names: true # Enable ParameterNames module for constructor parameter names | |
| jsr310: true # Enable JSR-310 module for Java 8 date | |
| kotlin: true # Enable Kotlin module for Kotlin classes | |
| joda: false # Disable Joda-Time module | |
| guava: false # Disable Guava module | |
| hibernate5: false # Disable Hibernate 5 module | |
| hibernate5-2: false # Disable Hibernate 5.2 module | |
| custom-serializers: [] # List of custom serializers to register | |
| custom-deserializers: [] # List of custom deserializers to register | |
| custom-modules: [] # List of custom modules to register | |
| visibility: | |
| field: ANY | |
| getter: NONE | |
| is-getter: NONE | |
| setter: NONE | |
| creator: NONE | |
| default-property-inclusion: non_null | |
| fail-on-empty-beans: false | |
| write-dates-as-timestamps: false | |
| write-dates-with-zone-id: true | |
| write-duration-as-timestamps: false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment