parent
4a990f3ed2
commit
f82b33698d
|
|
@ -333,6 +333,8 @@ To improve the user experience and further assist the user in configuring a give
|
|||
* Associates a provider, to attach a well defined semantic to a property, so that a tool can discover the list of potential values based on the project's context.
|
||||
|
||||
|
||||
|
||||
[[configuration-metadata-providing-manual-hints-value-hint]]
|
||||
=== Value Hint
|
||||
The `name` attribute of each hint refers to the `name` of a property.
|
||||
In the <<configuration-metadata-format,initial example shown earlier>>, we provide five values for the `spring.jpa.hibernate.ddl-auto` property: `none`, `validate`, `update`, `create`, and `create-drop`.
|
||||
|
|
@ -378,6 +380,7 @@ If your IDE supports it, this is by far the most effective approach to auto-comp
|
|||
|
||||
|
||||
|
||||
[[configuration-metadata-providing-manual-hints-value-providers]]
|
||||
=== Value Providers
|
||||
Providers are a powerful way to attach semantics to a property.
|
||||
In this section, we define the official providers that you can use for your own hints.
|
||||
|
|
@ -421,6 +424,7 @@ If no provider for a given property is supported, no special content assistance
|
|||
|
||||
|
||||
|
||||
[[configuration-metadata-providing-manual-hints-any]]
|
||||
==== Any
|
||||
The special **any** provider value permits any additional values to be provided.
|
||||
Regular value validation based on the property type should be applied if this is supported.
|
||||
|
|
@ -453,6 +457,9 @@ The following example offers `on` and `off` as auto-completion values for `syste
|
|||
|
||||
Note that, in the preceding example, any other value is also allowed.
|
||||
|
||||
|
||||
|
||||
[[configuration-metadata-providing-manual-hints-class-reference]]
|
||||
==== Class Reference
|
||||
The **class-reference** provider auto-completes classes available in the project.
|
||||
This provider supports the following parameters:
|
||||
|
|
@ -496,6 +503,7 @@ The following metadata snippet corresponds to the standard `server.servlet.jsp.c
|
|||
|
||||
|
||||
|
||||
[[configuration-metadata-providing-manual-hints-handle-as]]
|
||||
==== Handle As
|
||||
The **handle-as** provider lets you substitute the type of the property to a more high-level type.
|
||||
This typically happens when the property has a `java.lang.String` type, because you do not want your configuration classes to rely on classes that may not be on the classpath.
|
||||
|
|
@ -545,6 +553,7 @@ It is actually used internally as a `org.springframework.core.io.Resource` but c
|
|||
|
||||
|
||||
|
||||
[[configuration-metadata-providing-manual-hints-logger-name]]
|
||||
==== Logger Name
|
||||
The **logger-name** provider auto-completes valid logger names and <<spring-boot-features.adoc#boot-features-custom-log-groups,logger groups>>.
|
||||
Typically, package and class names available in the current project can be auto-completed.
|
||||
|
|
@ -631,6 +640,7 @@ As Spring Boot defines a few logger groups out-of-the-box, dedicated value hints
|
|||
|
||||
|
||||
|
||||
[[configuration-metadata-providing-manual-hints-spring-bean-reference]]
|
||||
==== Spring Bean Reference
|
||||
The **spring-bean-reference** provider auto-completes the beans that are defined in the configuration of the current project.
|
||||
This provider supports the following parameters:
|
||||
|
|
@ -670,6 +680,7 @@ If you provide that hint, you still need to transform the bean name into an actu
|
|||
|
||||
|
||||
|
||||
[[configuration-metadata-providing-manual-hints-spring-profile-name]]
|
||||
==== Spring Profile Name
|
||||
The **spring-profile-name** provider auto-completes the Spring profiles that are defined in the configuration of the current project.
|
||||
|
||||
|
|
@ -863,6 +874,7 @@ In order to document default values for properties in the class above, you could
|
|||
NOTE: Only the `name` of the property is required to document additional metadata for existing properties.
|
||||
|
||||
|
||||
|
||||
[[configuration-metadata-annotation-processor-metadata-generation-nested]]
|
||||
==== Nested Properties
|
||||
The annotation processor automatically considers inner classes as nested properties.
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ include::attributes.adoc[]
|
|||
|
||||
This appendix provides details of the dependencies that are managed by Spring Boot.
|
||||
|
||||
|
||||
|
||||
[[dependency-versions-coordinates]]
|
||||
== Managed Dependency Coordinates
|
||||
|
||||
|
|
@ -13,6 +15,8 @@ When you declare a dependency on one of these artifacts without declaring a vers
|
|||
|
||||
include::dependency-versions.adoc[]
|
||||
|
||||
|
||||
|
||||
[[dependency-versions-properties]]
|
||||
== Version Properties
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ include::attributes.adoc[]
|
|||
|
||||
This appendix describes the `@…Test` auto-configuration annotations that Spring Boot provides to test slices of your application.
|
||||
|
||||
|
||||
|
||||
[[test-auto-configuration-slices]]
|
||||
== Test Slices
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ Please refer to the plugin's documentation to learn more:
|
|||
* {spring-boot-maven-plugin-api}[API]
|
||||
|
||||
|
||||
|
||||
[[build-tool-plugins-gradle-plugin]]
|
||||
== Spring Boot Gradle Plugin
|
||||
The Spring Boot Gradle Plugin provides Spring Boot support in Gradle, letting you package executable jar or war archives, run Spring Boot applications, and use the dependency management provided by `spring-boot-dependencies`.
|
||||
|
|
@ -104,7 +105,6 @@ The following nested elements can be used with the task:
|
|||
|
||||
|
||||
|
||||
|
||||
[[spring-boot-ant-exejar-examples]]
|
||||
==== Examples
|
||||
This section shows two examples of Ant tasks.
|
||||
|
|
|
|||
|
|
@ -290,12 +290,14 @@ In this document, we describe to approach using AWS Elastic Beanstalk.
|
|||
|
||||
|
||||
|
||||
[[cloud-deployment-aws-beanstalk]]
|
||||
==== AWS Elastic Beanstalk
|
||||
As described in the official https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Java.html[Elastic Beanstalk Java guide], there are two main options to deploy a Java application.
|
||||
You can either use the "`Tomcat Platform`" or the "`Java SE platform`".
|
||||
|
||||
|
||||
|
||||
[[cloud-deployment-aws-tomcat-platform]]
|
||||
===== Using the Tomcat Platform
|
||||
This option applies to Spring Boot projects that produce a war file.
|
||||
No special configuration is required.
|
||||
|
|
@ -303,6 +305,7 @@ You need only follow the official guide.
|
|||
|
||||
|
||||
|
||||
[[cloud-deployment-aws-java-se-platform]]
|
||||
===== Using the Java SE Platform
|
||||
This option applies to Spring Boot projects that produce a jar file and run an embedded web container.
|
||||
Elastic Beanstalk environments run an nginx instance on port 80 to proxy the actual application, running on port 5000.
|
||||
|
|
@ -344,6 +347,7 @@ You can also create single instance environments by using the CLI and the follow
|
|||
|
||||
|
||||
|
||||
[[cloud-deployment-aws-summary]]
|
||||
==== Summary
|
||||
This is one of the easiest ways to get to AWS, but there are more things to cover, such as how to integrate Elastic Beanstalk into any CI / CD tool, use the Elastic Beanstalk Maven plugin instead of the CLI, and others.
|
||||
There is a https://exampledriven.wordpress.com/2017/01/09/spring-boot-aws-elastic-beanstalk-example/[blog post] covering these topics more in detail.
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ If you are getting started with Spring Boot or 'Spring' in general, start with <
|
|||
|
||||
|
||||
|
||||
[[boot-documentation-workingwith]]
|
||||
== Working with Spring Boot
|
||||
Ready to actually start using Spring Boot? <<using-spring-boot.adoc#using-boot, We have you covered>>:
|
||||
|
||||
|
|
@ -73,6 +74,7 @@ Ready to actually start using Spring Boot? <<using-spring-boot.adoc#using-boot,
|
|||
|
||||
|
||||
|
||||
[[boot-documentation-learning]]
|
||||
== Learning about Spring Boot Features
|
||||
Need more details about Spring Boot's core features?
|
||||
<<spring-boot-features.adoc#boot-features, The following content is for you>>:
|
||||
|
|
@ -86,6 +88,7 @@ Need more details about Spring Boot's core features?
|
|||
|
||||
|
||||
|
||||
[[boot-documentation-production]]
|
||||
== Moving to Production
|
||||
When you are ready to push your Spring Boot application to production, we have <<production-ready-features.adoc#production-ready, some tricks>> that you might like:
|
||||
|
||||
|
|
@ -95,6 +98,7 @@ When you are ready to push your Spring Boot application to production, we have <
|
|||
|
||||
|
||||
|
||||
[[boot-documentation-advanced]]
|
||||
== Advanced Topics
|
||||
Finally, we have a few topics for more advanced users:
|
||||
|
||||
|
|
|
|||
|
|
@ -588,6 +588,7 @@ If you still choose to use `h2c`, you can check <<howto-configure-http2-h2c, the
|
|||
====
|
||||
|
||||
|
||||
|
||||
[[howto-configure-http2-tomcat]]
|
||||
==== HTTP/2 with Tomcat
|
||||
Spring Boot ships by default with Tomcat 9.0.x which supports HTTP/2 out of the box when using JDK 9 or later.
|
||||
|
|
@ -607,6 +608,7 @@ Starting Tomcat 9.0.x on JDK 8 without that native support logs the following er
|
|||
This error is not fatal, and the application still starts with HTTP/1.1 SSL support.
|
||||
|
||||
|
||||
|
||||
[[howto-configure-http2-jetty]]
|
||||
==== HTTP/2 with Jetty
|
||||
For HTTP/2 support, Jetty requires the additional `org.eclipse.jetty.http2:http2-server` dependency.
|
||||
|
|
@ -694,7 +696,6 @@ For Undertow, we need to enable the HTTP2 option:
|
|||
|
||||
|
||||
|
||||
|
||||
[[howto-configure-webserver]]
|
||||
=== Configure the Web Server
|
||||
Generally, you should first consider using one of the many available configuration keys and customize your web server by adding new entries in your `application.properties` (or `application.yml`, or environment, etc. see "`<<howto-discover-build-in-options-for-external-properties>>`").
|
||||
|
|
@ -1297,6 +1298,8 @@ The following example configures `HttpComponentsClientRequestFactory` with an `H
|
|||
include::{code-examples}/web/client/RestTemplateProxyCustomizationExample.java[tag=customizer]
|
||||
----
|
||||
|
||||
|
||||
|
||||
[[howto-webclient-reactor-netty-customization]]
|
||||
=== Configure the TcpClient used by a Reactor Netty-based WebClient
|
||||
When Reactor Netty is on the classpath a Reactor Netty-based `WebClient` is auto-configured.
|
||||
|
|
@ -1312,6 +1315,7 @@ TIP: Note the use of `ReactorResourceFactory` for the connection provider and ev
|
|||
This ensures efficient sharing of resources for the server receiving requests and the client making requests.
|
||||
|
||||
|
||||
|
||||
[[howto-logging]]
|
||||
== Logging
|
||||
Spring Boot has no mandatory logging dependency, except for the Commons Logging API, which is typically provided by Spring Framework's `spring-jcl` module.
|
||||
|
|
@ -1873,6 +1877,7 @@ Spring Boot provides properties in the `spring.data.web` namespace for customizi
|
|||
Note that if you are using Spring Data REST, you must use the properties in the `spring.data.rest` namespace instead.
|
||||
|
||||
|
||||
|
||||
[[howto-use-exposing-spring-data-repositories-rest-endpoint]]
|
||||
=== Expose Spring Data Repositories as REST Endpoint
|
||||
Spring Data REST can expose the `Repository` implementations as REST endpoints for you,
|
||||
|
|
@ -2289,6 +2294,7 @@ For more about Spring Security, see the {spring-security}[Spring Security projec
|
|||
If you define a `@Configuration` with a `WebSecurityConfigurerAdapter` in your application, it switches off the default webapp security settings in Spring Boot.
|
||||
|
||||
|
||||
|
||||
[[howto-change-the-user-details-service-and-add-user-accounts]]
|
||||
=== Change the UserDetailsService and Add User Accounts
|
||||
If you provide a `@Bean` of type `AuthenticationManager`, `AuthenticationProvider`, or `UserDetailsService`, the default `@Bean` for `InMemoryUserDetailsManager` is not created.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[legal]
|
||||
[[legal]]
|
||||
= Legal
|
||||
|
||||
Copyright © 2012-2021
|
||||
|
|
|
|||
|
|
@ -659,6 +659,7 @@ If no `HealthIndicator` returns a status that is known to the `StatusAggregator`
|
|||
TIP: The `HealthContributorRegistry` can be used to register and unregister health indicators at runtime.
|
||||
|
||||
|
||||
|
||||
[[production-ready-health-indicators]]
|
||||
==== Auto-configured HealthIndicators
|
||||
The following `HealthIndicators` are auto-configured by Spring Boot when appropriate.
|
||||
|
|
@ -753,6 +754,7 @@ Additional `HealthIndicators` are available but not enabled by default:
|
|||
|
||||
|
||||
|
||||
[[production-ready-health-indicators-writing]]
|
||||
==== Writing Custom HealthIndicators
|
||||
To provide custom health information, you can register Spring beans that implement the {spring-boot-actuator-module-code}/health/HealthIndicator.java[`HealthIndicator`] interface.
|
||||
You need to provide an implementation of the `health()` method and return a `Health` response.
|
||||
|
|
@ -862,6 +864,7 @@ TIP: To handle the error automatically, consider extending from `AbstractReactiv
|
|||
|
||||
|
||||
|
||||
[[reactive-health-indicators-autoconfigured]]
|
||||
==== Auto-configured ReactiveHealthIndicators
|
||||
The following `ReactiveHealthIndicators` are auto-configured by Spring Boot when appropriate:
|
||||
|
||||
|
|
@ -889,6 +892,7 @@ TIP: If necessary, reactive indicators replace the regular ones.
|
|||
Also, any `HealthIndicator` that is not handled explicitly is wrapped automatically.
|
||||
|
||||
|
||||
|
||||
[[production-ready-health-groups]]
|
||||
==== Health Groups
|
||||
It's sometimes useful to organize health indicators into groups that can be used for different purposes.
|
||||
|
|
@ -2145,7 +2149,7 @@ NOTE: By default, metrics from all `MeterBinder` beans will be automatically bou
|
|||
|
||||
|
||||
|
||||
[[production-ready-metrics-per-meter-properties]]
|
||||
[[production-ready-metrics-customizing]]
|
||||
=== Customizing individual metrics
|
||||
If you need to apply customizations to specific `Meter` instances you can use the `io.micrometer.core.instrument.config.MeterFilter` interface.
|
||||
|
||||
|
|
@ -2180,6 +2184,7 @@ As the order of common tags cannot be guaranteed using this approach, Graphite u
|
|||
|
||||
|
||||
|
||||
[[production-ready-metrics-per-meter-properties]]
|
||||
==== Per-meter properties
|
||||
In addition to `MeterFilter` beans, it's also possible to apply a limited set of customization on a per-meter basis using properties.
|
||||
Per-meter customizations apply to any all meter IDs that start with the given name.
|
||||
|
|
@ -2354,6 +2359,7 @@ If your Cloud Foundry UAA or Cloud Controller services use self-signed certifica
|
|||
|
||||
|
||||
|
||||
[[production-ready-custom-context-path]]
|
||||
=== Custom context path
|
||||
If the server's context-path has been configured to anything other than `/`, the Cloud Foundry endpoints will not be available at the root of the application.
|
||||
For example, if `server.servlet.context-path=/app`, Cloud Foundry endpoints will be available at `/app/cloudfoundryapplication/*`.
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ This will also turn off logging of the application's active profiles.
|
|||
TIP: To add additional logging during startup, you can override `logStartupInfo(boolean)` in a subclass of `SpringApplication`.
|
||||
|
||||
|
||||
|
||||
[[boot-features-startup-failure]]
|
||||
=== Startup Failure
|
||||
If your application fails to start, registered `FailureAnalyzers` get a chance to provide a dedicated error message and a concrete action to fix the problem.
|
||||
|
|
@ -557,7 +558,6 @@ This means that the JSON cannot override properties from lower order property so
|
|||
|
||||
|
||||
|
||||
|
||||
[[boot-features-external-config-random-values]]
|
||||
=== Configuring Random Values
|
||||
The `RandomValuePropertySource` is useful for injecting random values (for example, into secrets or test cases).
|
||||
|
|
@ -1299,7 +1299,7 @@ The properties above will bind to a `Map` with `/key1`, `/key2` and `key3` as th
|
|||
The slash has been removed from `key3` because it wasn't surrounded by square brackets.
|
||||
|
||||
You may also occasionally need to use the bracket notation if your `key` contains a `.` and you are binding to non-scalar value.
|
||||
For example, binding `a.b=c` to `Map<String, Object>` will return a Map with the entry `{"a"={"b"="c"}}` where as `[a.b]=c` will return a Map with the entry `{"a.b"="c"}`.
|
||||
For example, binding `a.b=c` to `Map<String, Object>` will return a Map with the entry `{"a"={"b"="c"}}` where as `[a.b]=c` will return a Map with the entry `{"a.b"="c"}`.
|
||||
|
||||
|
||||
|
||||
|
|
@ -1728,6 +1728,7 @@ TIP: When you deploy your application to a servlet container or application serv
|
|||
This prevents logging performed by the container or other applications that have been deployed to it from appearing in your application's logs.
|
||||
|
||||
|
||||
|
||||
[[boot-features-logging-format]]
|
||||
=== Log Format
|
||||
The default log output from Spring Boot resembles the following example:
|
||||
|
|
@ -2098,6 +2099,7 @@ If you attempt to do so, making changes to the configuration file results in an
|
|||
|
||||
|
||||
|
||||
[[boot-features-logback-extensions-profile-specific]]
|
||||
==== Profile-specific Configuration
|
||||
The `<springProfile>` tag lets you optionally include or exclude sections of configuration based on the active Spring profiles.
|
||||
Profile sections are supported anywhere within the `<configuration>` element.
|
||||
|
|
@ -2124,6 +2126,7 @@ The following listing shows three sample profiles:
|
|||
|
||||
|
||||
|
||||
[[boot-features-logback-environment-properties]]
|
||||
==== Environment Properties
|
||||
The `<springProperty>` tag lets you expose properties from the Spring `Environment` for use within Logback.
|
||||
Doing so can be useful if you want to access values from your `application.properties` file in your Logback configuration.
|
||||
|
|
@ -2433,6 +2436,8 @@ See {spring-boot-autoconfigure-module-code}/web/ResourceProperties.java[`Resourc
|
|||
This feature has been thoroughly described in a dedicated https://spring.io/blog/2014/07/24/spring-framework-4-1-handling-static-web-resources[blog post] and in Spring Framework's {spring-framework-docs}/web.html#mvc-config-static-resources[reference documentation].
|
||||
====
|
||||
|
||||
|
||||
|
||||
[[boot-features-spring-mvc-welcome-page]]
|
||||
==== Welcome Page
|
||||
Spring Boot supports both static and templated welcome pages.
|
||||
|
|
@ -2533,7 +2538,7 @@ For machine clients, it produces a JSON response with details of the error, the
|
|||
For browser clients, there is a "`whitelabel`" error view that renders the same data in HTML format (to customize it, add a `View` that resolves to `error`).
|
||||
|
||||
There are a number of `server.error` properties that can be set if you want to customize the default error handling behavior.
|
||||
See the <<appendix-application-properties.adoc#common-application-properties-server, "`Server Properties`">> section of the Appendix.
|
||||
See the <<appendix-application-properties.adoc#common-application-properties-server, "`Server Properties`">> section of the Appendix.
|
||||
|
||||
To replace the default behavior completely, you can implement `ErrorController` and register a bean definition of that type or add a bean of type `ErrorAttributes` to use the existing mechanism but replace the contents.
|
||||
|
||||
|
|
@ -2685,7 +2690,6 @@ To do so, set the `spring.security.filter.dispatcher-types` property to `async,
|
|||
|
||||
|
||||
|
||||
|
||||
[[boot-features-spring-hateoas]]
|
||||
==== Spring HATEOAS
|
||||
If you develop a RESTful API that makes use of hypermedia, Spring Boot provides auto-configuration for Spring HATEOAS that works well with most applications.
|
||||
|
|
@ -2873,6 +2877,7 @@ Any resources with a path in `+/webjars/**+` are served from jar files if they a
|
|||
TIP: Spring WebFlux applications do not strictly depend on the Servlet API, so they cannot be deployed as war files and do not use the `src/main/webapp` directory.
|
||||
|
||||
|
||||
|
||||
[[boot-features-webflux-welcome-page]]
|
||||
==== Welcome Page
|
||||
Spring Boot supports both static and templated welcome pages.
|
||||
|
|
@ -3263,6 +3268,7 @@ The `spring-messaging` module of the Spring Framework provides support for RSock
|
|||
See the {spring-framework-docs}/web-reactive.html#rsocket-spring[RSocket section] of the Spring Framework reference for more details, including an overview of the RSocket protocol.
|
||||
|
||||
|
||||
|
||||
[[boot-features-rsocket-strategies-auto-configuration]]
|
||||
=== RSocket Strategies Auto-configuration
|
||||
Spring Boot auto-configures an `RSocketStrategies` bean that provides all the required infrastructure for encoding and decoding RSocket payloads.
|
||||
|
|
@ -3278,6 +3284,7 @@ Developers can customize the `RSocketStrategies` component by creating beans tha
|
|||
Note that their `@Order` is important, as it determines the order of codecs.
|
||||
|
||||
|
||||
|
||||
[[boot-features-rsocket-server-auto-configuration]]
|
||||
=== RSocket server Auto-configuration
|
||||
Spring Boot provides RSocket server auto-configuration.
|
||||
|
|
@ -3558,12 +3565,14 @@ Alternatively, you can define your own `OpaqueTokenIntrospector` bean for servle
|
|||
|
||||
|
||||
|
||||
[[boot-features-security-authorization-server]]
|
||||
==== Authorization Server
|
||||
Currently, Spring Security does not provide support for implementing an OAuth 2.0 Authorization Server.
|
||||
However, this functionality is available from the {spring-security-oauth2}[Spring Security OAuth] project, which will eventually be superseded by Spring Security completely.
|
||||
Until then, you can use the `spring-security-oauth2-autoconfigure` module to easily set up an OAuth 2.0 authorization server; see its https://docs.spring.io/spring-security-oauth2-boot/[documentation] for instructions.
|
||||
|
||||
|
||||
|
||||
[[boot-features-security-saml]]
|
||||
=== SAML 2.0
|
||||
|
||||
|
|
@ -3982,6 +3991,7 @@ Both the commercial and open source editions can be used with Spring Boot.
|
|||
|
||||
|
||||
|
||||
[[boot-features-jooq-codegen]]
|
||||
==== Code Generation
|
||||
In order to use jOOQ type-safe queries, you need to generate Java classes from your database schema.
|
||||
You can follow the instructions in the {jooq-docs}/#jooq-in-7-steps-step3[jOOQ user manual].
|
||||
|
|
@ -4018,6 +4028,7 @@ The following listing shows an example:
|
|||
|
||||
|
||||
|
||||
[[boot-features-jooq-dslcontext]]
|
||||
==== Using DSLContext
|
||||
The fluent API offered by jOOQ is initiated through the `org.jooq.DSLContext` interface.
|
||||
Spring Boot auto-configures a `DSLContext` as a Spring Bean and connects it to your application `DataSource`.
|
||||
|
|
@ -4053,6 +4064,7 @@ You can then use the `DSLContext` to construct your queries, as shown in the fol
|
|||
|
||||
|
||||
|
||||
[[boot-features-jooq-sqldialect]]
|
||||
==== jOOQ SQL Dialect
|
||||
Unless the configprop:spring.jooq.sql-dialect[] property has been configured, Spring Boot determines the SQL dialect to use for your datasource.
|
||||
If Spring Boot could not detect the dialect, it uses `DEFAULT`.
|
||||
|
|
@ -4061,6 +4073,7 @@ NOTE: Spring Boot can only auto-configure dialects supported by the open source
|
|||
|
||||
|
||||
|
||||
[[boot-features-jooq-customizing]]
|
||||
==== Customizing jOOQ
|
||||
More advanced customizations can be achieved by defining your own `@Bean` definitions, which is used when the jOOQ `Configuration` is created.
|
||||
You can define beans for the following jOOQ Types:
|
||||
|
|
@ -4551,6 +4564,7 @@ There is a `spring-boot-starter-data-solr` "`Starter`" for collecting the depend
|
|||
NOTE: As of Spring Boot 2.3, support for Spring Data Solr has been deprecated and will be removed in a future release.
|
||||
|
||||
|
||||
|
||||
[[boot-features-connecting-to-solr]]
|
||||
==== Connecting to Solr
|
||||
You can inject an auto-configured `SolrClient` instance as you would any other Spring bean.
|
||||
|
|
@ -4603,6 +4617,7 @@ Spring Boot supports several clients:
|
|||
Spring Boot provides a dedicated "`Starter`", `spring-boot-starter-data-elasticsearch`.
|
||||
|
||||
|
||||
|
||||
[[boot-features-connecting-to-elasticsearch-rest]]
|
||||
==== Connecting to Elasticsearch using REST clients
|
||||
Elasticsearch ships https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/index.html[two different REST clients] that you can use to query a cluster: the "Low Level" client and the "High Level" client.
|
||||
|
|
@ -4624,6 +4639,7 @@ To take full control over the registration, define a `RestClientBuilder` bean.
|
|||
If you have the `org.elasticsearch.client:elasticsearch-rest-high-level-client` dependency on the classpath, Spring Boot will auto-configure a `RestHighLevelClient`, which leverages any existing `RestClientBuilder` bean, reusing its HTTP configuration.
|
||||
|
||||
|
||||
|
||||
[[boot-features-connecting-to-elasticsearch-reactive-rest]]
|
||||
==== Connecting to Elasticsearch using Reactive REST clients
|
||||
{spring-data-elasticsearch}[Spring Data Elasticsearch] ships `ReactiveElasticsearchClient` for querying Elasticsearch instances in a reactive fashion.
|
||||
|
|
@ -4645,6 +4661,8 @@ You can further tune how it is configured, as shown in the following example:
|
|||
If the configuration properties are not enough and you'd like to fully control the client
|
||||
configuration, you can register a custom `ClientConfiguration` bean.
|
||||
|
||||
|
||||
|
||||
[[boot-features-connecting-to-elasticsearch-spring-data]]
|
||||
==== Connecting to Elasticsearch by Using Spring Data
|
||||
To connect to Elasticsearch, a `RestHighLevelClient` bean must be defined,
|
||||
|
|
@ -4698,6 +4716,7 @@ You can choose to disable the repositories support with the following property:
|
|||
----
|
||||
|
||||
|
||||
|
||||
[[boot-features-cassandra]]
|
||||
=== Cassandra
|
||||
https://cassandra.apache.org/[Cassandra] is an open source, distributed database management system designed to handle large amounts of data across many commodity servers.
|
||||
|
|
@ -5210,7 +5229,6 @@ include::{code-examples}/cache/RedisCacheManagerCustomizationExample.java[tag=co
|
|||
|
||||
|
||||
|
||||
|
||||
[[boot-features-caching-provider-caffeine]]
|
||||
==== Caffeine
|
||||
https://github.com/ben-manes/caffeine[Caffeine] is a Java 8 rewrite of Guava's cache that supersedes support for Guava.
|
||||
|
|
@ -6313,6 +6331,7 @@ This will cause the auto-configuration to back off.
|
|||
Spring Session can then be configured using the annotation's attributes rather than the previously described configuration properties.
|
||||
|
||||
|
||||
|
||||
[[boot-features-jmx]]
|
||||
== Monitoring and Management over JMX
|
||||
Java Management Extensions (JMX) provide a standard mechanism to monitor and manage applications.
|
||||
|
|
@ -6494,7 +6513,6 @@ See {spring-boot-module-api}/context/TypeExcludeFilter.html[the Javadoc] for det
|
|||
|
||||
|
||||
|
||||
|
||||
[[boot-features-testing-spring-boot-application-arguments]]
|
||||
==== Using Application Arguments
|
||||
If your application expects <<boot-features-application-arguments,arguments>>, you can
|
||||
|
|
@ -7926,11 +7944,13 @@ The following example shows how to use the `ConditionEvaluationReportLoggingList
|
|||
|
||||
|
||||
|
||||
[[boot-features-test-autoconfig-simulating-web-context]]
|
||||
==== Simulating a Web Context
|
||||
If you need to test an auto-configuration that only operates in a Servlet or Reactive web application context, use the `WebApplicationContextRunner` or `ReactiveWebApplicationContextRunner` respectively.
|
||||
|
||||
|
||||
|
||||
[[boot-features-test-autoconfig-overriding-classpath]]
|
||||
==== Overriding the Classpath
|
||||
It is also possible to test what happens when a particular class and/or package is not present at runtime.
|
||||
Spring Boot ships with a `FilteredClassLoader` that can easily be used by the runner.
|
||||
|
|
@ -8209,6 +8229,7 @@ The version can be customized via the `kotlin-coroutines.version` property.
|
|||
TIP: `org.jetbrains.kotlinx:kotlinx-coroutines-reactor` dependency is provided by default if one bootstraps a Kotlin project with at least one reactive dependency on https://start.spring.io/#!language=kotlin[start.spring.io].
|
||||
|
||||
|
||||
|
||||
[[boot-features-kotlin-configuration-properties]]
|
||||
=== @ConfigurationProperties
|
||||
`@ConfigurationProperties` when used in combination with <<boot-features-external-config-constructor-binding,`@ConstructorBinding`>> supports classes with immutable `val` properties as shown in the following example:
|
||||
|
|
@ -8290,6 +8311,8 @@ The other issue is that putting your application's code and all its dependencies
|
|||
Since you probably recompile your code more often than you upgrade the version of Spring Boot you use, it’s often better to separate things a bit more.
|
||||
If you put jar files in the layer before your application classes, Docker often only needs to change the very bottom layer and can pick others up from its cache.
|
||||
|
||||
|
||||
|
||||
[[boot-layering-docker-images]]
|
||||
=== Layering Docker Images
|
||||
To make it easier to create optimized Docker images, Spring Boot supports adding a layer index file to the jar.
|
||||
|
|
@ -8326,9 +8349,14 @@ Application code is more likely to change between builds so it is isolated in a
|
|||
For Maven, refer to the {spring-boot-maven-plugin-docs}#repackage-layers[packaging layered jars section] for more details on adding a layer index to the jar.
|
||||
For Gradle, refer to the {spring-boot-gradle-plugin-docs}#packaging-layered-jars[packaging layered jars section] of the Gradle plugin documentation.
|
||||
|
||||
|
||||
|
||||
[[boot-features-container-images-building]]
|
||||
=== Building Container Images
|
||||
Spring Boot applications can be containerized <<boot-features-container-images-docker,using Dockerfiles>>, or by <<boot-features-container-images-buildpacks,using Cloud Native Buildpacks to create docker compatible container images that you can run anywhere>>.
|
||||
|
||||
|
||||
|
||||
[[boot-features-container-images-docker]]
|
||||
==== Dockerfiles
|
||||
While it is possible to convert a Spring Boot fat jar into a docker image with just a few lines in the Dockerfile, we will use the <<boot-layering-docker-images,layering feature>> to create an optimized docker image.
|
||||
|
|
@ -8393,6 +8421,7 @@ Of course, a Dockerfile can be written without using the jarmode.
|
|||
You can use some combination of `unzip` and `mv` to move things to the right layer but jarmode simplifies that.
|
||||
|
||||
|
||||
|
||||
[[boot-features-container-images-buildpacks]]
|
||||
==== Cloud Native Buildpacks
|
||||
Dockerfiles are just one way to build docker images.
|
||||
|
|
|
|||
|
|
@ -590,7 +590,7 @@ The way in which you cause the classpath to be updated depends on the IDE that y
|
|||
|
||||
* In Eclipse, saving a modified file causes the classpath to be updated and triggers a restart.
|
||||
* In IntelliJ IDEA, building the project (`Build +->+ Build Project`) has the same effect.
|
||||
* If using a build plugin, running `mvn compile` for Maven or `gradle build` for Gradle will trigger a restart.
|
||||
* If using a build plugin, running `mvn compile` for Maven or `gradle build` for Gradle will trigger a restart.
|
||||
****
|
||||
|
||||
NOTE: If you are restarting with Maven or Gradle using the build plugin you must leave the `forking` set to `enabled`.
|
||||
|
|
@ -638,6 +638,7 @@ To disable the logging of the report, set the following property:
|
|||
----
|
||||
|
||||
|
||||
|
||||
[[using-boot-devtools-restart-exclude]]
|
||||
==== Excluding Resources
|
||||
Certain resources do not necessarily need to trigger a restart when they are changed.
|
||||
|
|
@ -852,6 +853,7 @@ The client component must be launched manually.
|
|||
|
||||
|
||||
|
||||
[[running-remote-client-application]]
|
||||
==== Running the Remote Client Application
|
||||
The remote client application is designed to be run from within your IDE.
|
||||
You need to run `org.springframework.boot.devtools.RemoteSpringApplication` with the same classpath as the remote project that you connect to.
|
||||
|
|
|
|||
Loading…
Reference in New Issue