Browse Source

DATACMNS-552 - Naming conventions for custom repository implementations are now more obvious.

Added a note to hint to the Impl postfix to be important and refer to the paragraphs following for more details on that,
pull/93/head
Oliver Gierke 12 years ago
parent
commit
3c38218940
  1. 10
      src/main/asciidoc/repositories.adoc

10
src/main/asciidoc/repositories.adoc

@ -414,6 +414,8 @@ class UserRepositoryImpl implements UserRepositoryCustom { @@ -414,6 +414,8 @@ class UserRepositoryImpl implements UserRepositoryCustom {
----
====
NOTE: The most important bit for the class to be found is the `Impl` postfix of the name on it compared to the core repository interface (see below).
The implementation itself does not depend on Spring Data and can be a regular Spring bean. So you can use standard dependency injection behavior to inject references to other beans like a JdbTemplate, take part in aspects, and so on.
.Changes to the your basic repository interface
@ -442,11 +444,13 @@ If you use namespace configuration, the repository infrastructure tries to autod @@ -442,11 +444,13 @@ If you use namespace configuration, the repository infrastructure tries to autod
----
====
The first configuration example will try to look up a class com.acme.repository.UserRepositoryImpl to act as custom repository implementation, whereas the second example will try to lookup com.acme.repository.UserRepositoryFooBar.
The first configuration example will try to look up a class `com.acme.repository.UserRepositoryImpl` to act as custom repository implementation, whereas the second example will try to lookup `com.acme.repository.UserRepositoryFooBar`.
===== Manual wiring
Manual wiring The preceding approach works well if your custom implementation uses annotation-based configuration and autowiring only, as it will be treated as any other Spring bean. If your custom implementation bean needs special wiring, you simply declare the bean and name it after the conventions just described. The infrastructure will then refer to the manually defined bean definition by name instead of creating one itself.
The approach just shown works well if your custom implementation uses annotation-based configuration and autowiring only, as it will be treated as any other Spring bean. If your custom implementation bean needs special wiring, you simply declare the bean and name it after the conventions just described. The infrastructure will then refer to the manually defined bean definition by name instead of creating one itself.
.Manual wiring of custom implementations (I)
.Manual wiring of custom implementations
====
[source, xml]
----

Loading…
Cancel
Save