You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-docs/src/docs/antora/modules/how-to/pages/data-access.adoc
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -113,6 +113,9 @@ See xref:reference:data/sql.adoc#data.sql.datasource[] in the "`Spring Boot Feat
113
113
To define an additional `DataSource`, an approach that's similar to the previous section can be used.
114
114
A key difference is that the `DataSource` `@Bean` must be declared with `defaultCandidate=false`.
115
115
This prevents the auto-configured `DataSource` from backing off.
116
+
117
+
NOTE: The {url-spring-framework-docs}/core/beans/dependencies/factory-autowire.html#beans-factory-autowire-candidate[Spring Framework reference documentation] describes this feature in more details.
118
+
116
119
To allow the additional `DataSource` to be injected where it's needed, also annotate it with `@Qualifier` as shown in the following example:
@@ -314,6 +317,8 @@ It scans entities located in the same package as `Order`.
314
317
It is possible to map additional JPA properties using the `app.jpa` namespace.
315
318
The use of `@Bean(defaultCandidate=false)` allows the `secondJpaProperties` and `secondEntityManagerFactory` beans to be defined without interfering with auto-configured beans of the same type.
316
319
320
+
NOTE: The {url-spring-framework-docs}/core/beans/dependencies/factory-autowire.html#beans-factory-autowire-candidate[Spring Framework reference documentation] describes this feature in more details.
321
+
317
322
You should provide a similar configuration for any more additional data sources for which you need JPA access.
318
323
To complete the picture, you need to configure a `JpaTransactionManager` for each `EntityManagerFactory` as well.
319
324
Alternatively, you might be able to use a JTA transaction manager that spans both.
0 commit comments