Add auto-configuration for JdbcClient

Closes gh-36579
This commit is contained in:
Stephane Nicoll
2023-08-01 15:21:34 +02:00
parent 5544ccdcba
commit 38dbc644ae
7 changed files with 198 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
[[data.sql]]
== SQL Databases
The {spring-framework}[Spring Framework] provides extensive support for working with SQL databases, from direct JDBC access using `JdbcTemplate` to complete "`object relational mapping`" technologies such as Hibernate.
The {spring-framework}[Spring Framework] provides extensive support for working with SQL databases, from direct JDBC access using `JdbcClient` or `JdbcTemplate` to complete "`object relational mapping`" technologies such as Hibernate.
{spring-data}[Spring Data] provides an additional level of functionality: creating `Repository` implementations directly from interfaces and using conventions to generate queries from your method names.
@@ -176,6 +176,17 @@ If more than one `JdbcTemplate` is defined and no primary candidate exists, the
[[data.sql.jdbc-client]]
=== Using JdbcClient
Spring's `JdbcClient` is auto-configured based on the presence of a `NamedParameterJdbcTemplate`.
You can inject it directly in your own beans as well, as shown in the following example:
include::code:MyBean[]
If you rely on auto-configuration to create the underlying `JdbcTemplate`, any customization using `spring.jdbc.template.*` properties are taken into account in the client as well.
[[data.sql.jpa-and-spring-data]]
=== JPA and Spring Data JPA
The Java Persistence API is a standard technology that lets you "`map`" objects to relational databases.

View File

@@ -217,6 +217,7 @@ Spring Boot will automatically detect beans of the following types that depends
- `AbstractEntityManagerFactoryBean` (unless configprop:spring.jpa.defer-datasource-initialization[] is set to `true`)
- `DSLContext` (jOOQ)
- `EntityManagerFactory` (unless configprop:spring.jpa.defer-datasource-initialization[] is set to `true`)
- `JdbcClient`
- `JdbcOperations`
- `NamedParameterJdbcOperations`