Ben Davies
Ben Davies

Reputation: 192

Referencing beans in xml config created via Annotations

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

Upvotes: 5

Views: 2606

Answers (1)

Bozho
Bozho

Reputation: 597382

  1. use @Service("myService")
  2. in the xml, use <property name="myProperty" ref="myService"/>

Upvotes: 8

Related Questions