Skip to content

Commit

Permalink
HSEARCH-3677 Fix incomplete documentation for dependency injection in…
Browse files Browse the repository at this point in the history
…to bridges
  • Loading branch information
yrodiere committed Jul 9, 2020
1 parent 6c2e635 commit 8eac163
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
Expand Up @@ -182,7 +182,15 @@ include::{sourcedir}/org/hibernate/search/documentation/mapper/orm/bridge/proper
== Injecting beans into the binder

With <<configuration-bean-frameworks,compatible frameworks>>,
Hibernate Search supports injection of beans into the `PropertyMappingAnnotationProcessor`.
Hibernate Search supports injecting beans into:

* the `PropertyMappingAnnotationProcessor` if you use custom annotations and instantiate the binder yourself.
* the `PropertyBinder` if you use the `@PropertyBinding` annotation and let Hibernate Search
instantiate the binder using your dependency injection framework.

NOTE: This only applies to binders instantiated by Hibernate Search itself.
As a rule of thumb, if you need to call `new MyBinder()` at some point,
the binder won't get auto-magically injected.

The context passed to the property binder's `bind` method
also exposes a `getBeanResolver` method to access the bean resolver and instantiate beans explicitly.
Expand Down
Expand Up @@ -26,7 +26,7 @@ This involves extracting data from an instance of the type, transforming the dat
and pushing it to index fields.

Below is an example of a custom type bridge that maps
a two properties of the `Author` class, the `firstName` and `lastName`,
two properties of the `Author` class, the `firstName` and `lastName`,
to a single `fullName` field.

// Search 5 anchors backward compatibility
Expand Down Expand Up @@ -162,9 +162,17 @@ include::{sourcedir}/org/hibernate/search/documentation/mapper/orm/bridge/typebr
== Injecting beans into the binder

With <<configuration-bean-frameworks,compatible frameworks>>,
Hibernate Search supports injection of beans into the `TypeMappingAnnotationProcessor`.
Hibernate Search supports injecting beans into:

The context passed to the type binder's `bind` method
* the `TypeMappingAnnotationProcessor` if you use custom annotations and instantiate the binder yourself.
* the `TypeBinder` if you use the `@TypeBinding` annotation and let Hibernate Search
instantiate the binder using your dependency injection framework.

NOTE: This only applies to binders instantiated by Hibernate Search itself.
As a rule of thumb, if you need to call `new MyBinder()` at some point,
the binder won't get auto-magically injected.

The context passed to the routing key binder's `bind` method
also exposes a `getBeanResolver` method to access the bean resolver and instantiate beans explicitly.

See <<configuration-bean-injection>> for more details.
Expand Down
Expand Up @@ -360,9 +360,9 @@ The `Session` is not available here.
== Injecting beans into the value bridge or value binder

With <<configuration-bean-frameworks,compatible frameworks>>,
Hibernate Search supports injection of beans into both the `ValueBridge` and the `ValueBinder`.
Hibernate Search supports injecting beans into both the `ValueBridge` and the `ValueBinder`.

NOTE: This only applies to beans instantiated by Hibernate Search itself.
NOTE: This only applies to bridges/binders instantiated by Hibernate Search itself.
As a rule of thumb, if you need to call `new MyBridge()` at some point,
the bridge won't get auto-magically injected.

Expand Down

0 comments on commit 8eac163

Please sign in to comment.