<commit_before>[[production-ready]]
= Production-ready features

[partintro]
--
Spring Boot includes a number of additional features to help you monitor and manage your
application when it's pushed to production. You can choose to manage and monitor your
application using HTTP endpoints, with JMX or even by remote shell (SSH or Telnet).
Auditing, health and metrics gathering can be automatically applied to your application.
--



[[production-ready-enabling]]
== Enabling production-ready features.
The `spring-boot-actuator` module provides all of Spring Boot's production-ready
features. The simplest way to enable the features is to add a dependency to the
`spring-boot-starter-actuator` ``Starter POM''.

.Definition of Actuator
****
An actuator is a manufacturing term, referring to a mechanical device for moving or
controlling something. Actuators can generate a large amount of motion from a small
change.
****

To add the actuator to a Maven based project, add the following ``starter''
dependency:

[source,xml,indent=0]
----
	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-actuator</artifactId>
		</dependency>
	</dependencies>
----

For Gradle, use the declaration:

[source,groovy,indent=0]
----
	dependencies {
		compile("org.springframework.boot:spring-boot-starter-actuator")
	}
----



[[production-ready-endpoints]]
== Endpoints
Actuator endpoints allow you to monitor and interact with your application. Spring Boot
includes a number of built-in endpoints and you can also add your own. For example the
`health` endpoint provides basic application health information.

The way that endpoints are exposed will depend on the type of technology that you choose.
Most applications choose HTTP monitoring, where the ID of the endpoint is mapped
to a URL. For example, by default, the `health` endpoint will be mapped to `/health`.

The following endpoints are available:

[cols="2,5,1"]
|===
| ID | Description | Sensitive

|`autoconfig`
|Displays an auto-configuration report showing all auto-configuration candidates and the
 reason why they ``were'' or ``were not'' applied.
|true

|`beans`
|Displays a complete list of all the Spring Beans in your application.
|true

|`configprops`
|Displays a collated list of all `@ConfigurationProperties`.
|true

|`dump`
|Performs a thread dump.
|true

|`env`
|Exposes properties from Spring's `ConfigurableEnvironment`.
|true

|`health`
|Shows application health information (defaulting to a simple ``OK'' message).
|false

|`info`
|Displays arbitrary application info.
|false

|`metrics`
|Shows ``metrics'' information for the current application.
|true

|`mappings`
|Displays a collated list of all `@RequestMapping` paths.
|true

|`shutdown`
|Allows the application to be gracefully shutdown (not enabled by default).
|true

|`trace`
|Displays trace information (by default the last few HTTP requests).
|true
|===

NOTE: Depending on how an endpoint is exposed, the `sensitive` parameter may be used as
a security hint. For example, sensitive endpoints will require a username/password when
they are accessed over HTTP (or simply disabled if web security is not enabled).



[[production-ready-customizing-endpoints]]
=== Customizing endpoints
Endpoints can be customized using Spring properties. You can change if an endpoint is
`enabled`, if it is considered `sensitive` and even its `id`.

For example, here is an `application.properties` that changes the sensitivity and id
of the `beans` endpoint and also enables `shutdown`.

[source,properties,indent=0]
----
	endpoints.beans.id=springbeans
	endpoints.beans.sensitive=false
	endpoints.shutdown.enabled=true
----

NOTE: The prefix "`endpoints` + `.` + `name`" is used to uniquely identify the endpoint
that is being configured.



[[production-ready-health]]
=== Custom health information
The default information exposed by the `health` endpoint is a simple ``OK'' message. It
is often useful to perform some additional health checks, for example you might check
that a database connection works, or that a remote REST endpoint is functioning.

To provide custom health information you can register a Spring bean that implements the
{sc-spring-boot-actuator}/health/HealthIndicator.{sc-ext}[`HealthIndicator`] interface.

[source,java,indent=0]
----
	import org.springframework.boot.actuate.health.HealthIndicator;
	import org.springframework.stereotype.Component;

	@Component
	public class MyHealth implements HealthIndicator<String> {

		@Override
		public String health() {
			// perform some specific health check
			return ...
		}

	}
----

Spring Boot provides a
{sc-spring-boot-actuator}/health/SimpleDatabaseHealthIndicator.{sc-ext}[`SimpleDatabaseHealthIndicator`]
implementation that attempts a simple database test as well as implementations for
Redis, MongoDB and RabbitMQ.

Spring Boot adds the `HealthIndicator` instances automatically if beans of type `DataSource`,
`MongoTemplate`, `RedisConnectionFactory`, `RabbitTemplate` are present in the `ApplicationContext`.


<commit_msg>Update docs for new extended health support<commit_after>[[production-ready]]
= Production-ready features

[partintro]
--
Spring Boot includes a number of additional features to help you monitor and manage your
application when it's pushed to production. You can choose to manage and monitor your
application using HTTP endpoints, with JMX or even by remote shell (SSH or Telnet).
Auditing, health and metrics gathering can be automatically applied to your application.
--



[[production-ready-enabling]]
== Enabling production-ready features.
The `spring-boot-actuator` module provides all of Spring Boot's production-ready
features. The simplest way to enable the features is to add a dependency to the
`spring-boot-starter-actuator` ``Starter POM''.

.Definition of Actuator
****
An actuator is a manufacturing term, referring to a mechanical device for moving or
controlling something. Actuators can generate a large amount of motion from a small
change.
****

To add the actuator to a Maven based project, add the following ``starter''
dependency:

[source,xml,indent=0]
----
	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-actuator</artifactId>
		</dependency>
	</dependencies>
----

For Gradle, use the declaration:

[source,groovy,indent=0]
----
	dependencies {
		compile("org.springframework.boot:spring-boot-starter-actuator")
	}
----



[[production-ready-endpoints]]
== Endpoints
Actuator endpoints allow you to monitor and interact with your application. Spring Boot
includes a number of built-in endpoints and you can also add your own. For example the
`health` endpoint provides basic application health information.

The way that endpoints are exposed will depend on the type of technology that you choose.
Most applications choose HTTP monitoring, where the ID of the endpoint is mapped
to a URL. For example, by default, the `health` endpoint will be mapped to `/health`.

The following endpoints are available:

[cols="2,5,1"]
|===
| ID | Description | Sensitive

|`autoconfig`
|Displays an auto-configuration report showing all auto-configuration candidates and the
 reason why they ``were'' or ``were not'' applied.
|true

|`beans`
|Displays a complete list of all the Spring Beans in your application.
|true

|`configprops`
|Displays a collated list of all `@ConfigurationProperties`.
|true

|`dump`
|Performs a thread dump.
|true

|`env`
|Exposes properties from Spring's `ConfigurableEnvironment`.
|true

|`health`
|Shows application health information (defaulting to a simple ``OK'' message).
|false

|`info`
|Displays arbitrary application info.
|false

|`metrics`
|Shows ``metrics'' information for the current application.
|true

|`mappings`
|Displays a collated list of all `@RequestMapping` paths.
|true

|`shutdown`
|Allows the application to be gracefully shutdown (not enabled by default).
|true

|`trace`
|Displays trace information (by default the last few HTTP requests).
|true
|===

NOTE: Depending on how an endpoint is exposed, the `sensitive` parameter may be used as
a security hint. For example, sensitive endpoints will require a username/password when
they are accessed over HTTP (or simply disabled if web security is not enabled).



[[production-ready-customizing-endpoints]]
=== Customizing endpoints
Endpoints can be customized using Spring properties. You can change if an endpoint is
`enabled`, if it is considered `sensitive` and even its `id`.

For example, here is an `application.properties` that changes the sensitivity and id
of the `beans` endpoint and also enables `shutdown`.

[source,properties,indent=0]
----
	endpoints.beans.id=springbeans
	endpoints.beans.sensitive=false
	endpoints.shutdown.enabled=true
----

NOTE: The prefix "`endpoints` + `.` + `name`" is used to uniquely identify the endpoint
that is being configured.



[[production-ready-health]]
=== Custom health information
The default information exposed by the `health` endpoint is a simple ``OK'' message. It
is often useful to perform some additional health checks, for example you might check
that a database connection works, or that a remote REST endpoint is functioning.

To provide custom health information you can register a Spring bean that implements the
{sc-spring-boot-actuator}/health/HealthIndicator.{sc-ext}[`HealthIndicator`] interface.

[source,java,indent=0]
----
	import org.springframework.boot.actuate.health.HealthIndicator;
	import org.springframework.stereotype.Component;

	@Component
	public class MyHealth implements HealthIndicator {

		@Override
		public Health health() {
			// perform some specific health check
			return ...
		}

	}
----

Spring Boot provides a
{sc-spring-boot-actuator}/health/SimpleDatabaseHealthIndicator.{sc-ext}[`SimpleDatabaseHealthIndicator`]
implementation that attempts a simple database test as well as implementations for
Redis, MongoDB and RabbitMQ.

Spring Boot adds the `HealthIndicator` instances automatically if beans of type `DataSource`,
`MongoTemplate`, `RedisConnectionFactory`, `RabbitTemplate` are present in the `ApplicationContext`.

Besides implementing custom `HealthIndicator`s and using out-of-box {sc-spring-boot-actuator}/health/Status.{sc-ext}[`Status`]
types, it is also possible to introduce custom `Status` types for different or more complex system 
states. In that case a custom implementation of the {sc-spring-boot-actuator}/health/HealthAggregator.{sc-ext}[`HealthAggregator`]
interface needs to be provided or the default implementation has to be configured using the 
`health.status.order` configuration property. 

Assuming a new `Status` with code `FATAL` is being used in one of your `HealthIndicator` 
implementations. To configure the severity or order add the following to your application properties:
`healt.status.order: FATAL, DOWN, UNKOWN, UP`.



{'fraction_non_alphanumeric': 0.08878718535469107, 'fraction_numerical': 0.0012814645308924484, 'mean_word_length': 4.993417443773999, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2143020', 'n_tokens_mistral': 3011, 'n_tokens_neox': 2855, 'n_words': 1272}