This repository was archived by the owner on Apr 14, 2022. It is now read-only.
Added AnnotationConfigSupport. #8
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
I've been browsing through the Spring Scala Jira and spotted issue [1] related to the autowiring support in Spring Scala.
While the author of the issue can just register regular
AutowiredAnnotationBeanPostProcessor
bean in order to use@Inject
in his beans, this is not in sync with configuration style used in Spring XML.In XML we would use
<context:annotation-config/>
. This is more higher level (aka DSL) approach than registeringAutowiredAnnotationBeanPostProcessor
explicitly in the context. The additional value gained from the<context:annotation-config/>
is that it registers some other useful bean processors and that it usesAnnotationConfigUtils#registerAnnotationConfigProcessors
under the hood. The usage ofAnnotationConfigUtils
cannot be overemphasized as it guarantees that only single instance of each annotation processor will be registered in the context.I think that Scala Spring users should get their
<annotation-config/>
DSL to enable annotation-based configuration as well.For Scala user preferring cake-like [2] configuration style we should provide
AnnotationConfigSupport
trait as well. The latter trait would enable annotation config the same way asannotationConfig = true
does.I believe that the proposed approach is the Scala-like way to provide this useful functionality to the
FunctionalConfiguration
users while keeping consistent style with the existing Spring XML goodies. What do you think about this idea?[1] https://jira.springsource.org/browse/SCALA-5
[2] http://jonasboner.com/2008/10/06/real-world-scala-dependency-injection-di