tags:

views:

30

answers:

1

This must be possible but I can't work out how or see it in the docs.

I need to reference a bean which has been created via an annotation @Service and context:component-scan, within a spring xml config file.

How is this achieved?

Cheers

+2  A: 
  1. use @Service("myService")
  2. in the xml, use <property name="myProperty" ref="myService"/>
Bozho
+1, though #1 is not strictly necessary. Default name will be set to uncapitalized unqualified class name; naming strategy can also be explicitly specified via `BeanNameGenerator`.
ChssPly76
Thanks, but isn't this the same as using @Service and a class named MyService? I'm pretty sure that's what I'm doing. Will check tomorrow when I'm back at the codebase.
standard
As ChssPly mentioned, it is the _uncapitalized_ class nam. So "MyClass" would be referenced as "myClass"
Bozho
I know, that's what i meant. Class MyService, @Service, ref="myService".Cheers
standard