0

I have some code that generates a class from an interface. I need to reference that interface in a Spring XML configuration. Is there a Spring 3 annotations I can use on the interface such that I can reference the generated implementation using <constructor-arg ref="myBeanInterface"/>?

I can reference it using <constructor-arg value="com.mysite.myBeanInterface"/>, however I want to refrence a bean name instead of an explicit class.

Details: The beans are generated by an extension of AbstractFactoryBean. I do not have access to the bean generating code.

Rylander
  • 19,449
  • 25
  • 93
  • 144

1 Answers1

0

Use the name of your factory bean. If you have something like:

<bean id="myBean class="MyBeanInterfaceFactoryBean>
    ...
</bean>

Then to inject the bean that was generated by the factory bean, just use myBean.

Stephane Nicoll
  • 31,977
  • 9
  • 97
  • 89