4

Is there any XML equivalent of @Configurable annotation?

For example for the bean:

<bean class="org.obliquid.sherd.domain.SalesDocument" scope ="prototype">
    <property name="docType" ref="documentTypeProto"/>
</bean>

How can I tell that SalesDocument should be @Configurable?

stivlo
  • 83,644
  • 31
  • 142
  • 199
  • Not an answer to your question, but if you need enhanced configuration support in spring, have a look at Constretto: https://github.com/constretto/constretto-core – ebaxt Mar 17 '12 at 12:30

2 Answers2

4

No - the purpose of @Configurable to inject properties into objects that are not Spring beans. In your example SalesDocument is already a Spring bean, and docType will be injected.

sourcedelica
  • 23,940
  • 7
  • 66
  • 74
0

There's no way to simply do this out of the box that I'm aware of.

One approach to achieve what you want is to look at using Spring AspectJ based AOP extensions. It'll be a lot of work, but if you know that your DAOs need limited configuration (probably the just the EntityManager?) it might be doable.

Look at the spring reference docs for details.

sw1nn
  • 7,278
  • 1
  • 26
  • 36