[[client-applications]]
== Client applications ==

[[show-version-in-application-list]]
=== Show version in application list ===

For *Spring Boot* applications the easiest way to show the version, is to use the `build-info` goal from the `spring-boot-maven-plugin`, which generates the `META-INF/build-info.properties`. See also the http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#howto-build-info[Spring Boot Reference Guide].

For *non-Spring Boot* applications you can either add a `version` or `build.version` to the registration metadata and the version will show up in the application list.

[source,xml]
.pom.xml
----
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>build-info</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
----

[[jmx-bean-management]]
=== JMX-bean management ===

To interact with JMX-beans in the admin UI you have to include https://jolokia.org/[Jolokia] in your application. As Jolokia is servlet based there is no support for reactive applications.
In case you are using the `spring-boot-admin-starter-client` it will be pulled in for you, if not add Jolokia to your dependencies:

[source,xml]
.pom.xml
----
<dependency>
    <groupId>org.jolokia</groupId>
    <artifactId>jolokia-core</artifactId>
</dependency>
----

[[logfile]]
=== Logfile viewer ===

By default the logfile is not accessible via actuator endpoints and therefore not visible in Spring Boot Admin.
In order to enable the logfile actuator endpoint you need to configure Spring Boot to write a logfile, either by setting
`logging.path` or `logging.file`.

Spring Boot Admin will detect everything that looks like an URL and render it as hyperlink.

ANSI color-escapes are also supported. You need to set a custom file log pattern as Spring Boot's default one doesn't use colors.

.application.properties
----
logging.file=/var/log/sample-boot-application.log <1>
logging.pattern.file=%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(${PID}){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wEx <2>
----
<1> Destination the logfile is written to. Enables the logfile actuator endpoint.
<2> File log pattern using ANSI colors.

[[spring-boot-admin-client]]
=== Spring Boot Admin Client ===

The Spring Boot Admin Client registers the application at the admin server. This is done by periodically doing a HTTP post request to the SBA Server providing information about the application. It also adds Jolokia to your application, so that JMX-beans are accessible via HTTP.

TIP: There are plenty of properties to influence the way how the SBA Client registers your application. In case that doesn't fit your needs, you can provide your own `AppliationFactory` implementation.

.Spring Boot Admin Client configuration options
|===
| Property name |Description |Default value

| spring.boot.admin.client.enabled
| Enables the Spring Boot Admin Client.
| `true`

| spring.boot.admin.client.url
| Comma separated ordered list of URLs of the Spring Boot Admin server to register at. This triggers the AutoConfiguration. *Mandatory*.
|

| spring.boot.admin.client.api-path
| Http-path of registration endpoint at your admin server.
| `"instances"`

| spring.boot.admin.client.username +
spring.boot.admin.client.password
| Username and password in case the SBA Server api is protected with HTTP Basic authentication.
|

| spring.boot.admin.client.period
| Interval for repeating the registration (in ms).
| `10,000`

| spring.boot.admin.client.connect-timeout
| Connect timeout for the registration (in ms).
| `5,000`

| spring.boot.admin.client.read-timeout
| Read timeout for the registration (in ms).
| `5,000`

| spring.boot.admin.client.auto-registration
| If set to true the periodic task to register the application is automatically scheduled after the application is ready.
| `true`

| spring.boot.admin.client.auto-deregistration
| Switch to enable auto-deregistration at Spring Boot Admin server when context is closed. If the value is unset the feature is active if a running CloudPlatform was detected.
| `null`

| spring.boot.admin.client.register-once
| If set to true the client will only register against one admin server (in order defined by `spring.boot.admin.instance.url`); if that admin server goes down, will automatically register against the next admin server. If false, will register against all admin servers.
| `true`

| spring.boot.admin.client.instance.health-url
| Health-url to register with. Can be overridden in case the reachable URL is different (e.g. Docker). Must be unique in registry.
| Guessed based on management-url and `endpoints.health.id`.

| spring.boot.admin.client.instance.management-base-url
| Base url for computing the management-url to register with. The path is inferred at runtime, and appended to the base url.
| Guessed based on `management.port`, service-url and `server.servlet-path`.

| spring.boot.admin.client.instance.management-url
| Management-url to register with. Can be overridden in case the reachable url is different (e.g. Docker).
| Guessed based on management-base-url and `management.context-path`.

| spring.boot.admin.client.instance.service-base-url
| Base url for computing the service-url to register with. The path is inferred at runtime, and appended to the base url.
| Guessed based on hostname, `server.port`.

| spring.boot.admin.client.instance.service-url
| Service-url to register with. Can be overridden in case the reachable url is different (e.g. Docker).
| Guessed based on service-base-url and `server.context-path`.

| spring.boot.admin.client.instance.name
| Name to register with.
| `${spring.application.name}` if set, `"spring-boot-application"` otherwise.

| spring.boot.admin.client.instance.prefer-ip
| Use the ip-address rather then the hostname in the guessed urls. If `server.address` / `management.address` is set, it get used. Otherwise the IP address returned from `InetAddress.getLocalHost()` gets used.
| `false`

| spring.boot.admin.client.instance.metadata.*
| Metadata key-value-pairs to be associated with this instance.
|
|===

.Instance metadata options
|===
| Key |Value |Default value

| user.name +
user.password
| Credentials being used to access the endpoints.
|
|===
