KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Let's say I have following Spring config (version of Spring is 3.0.3): <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="theFactoryBean" class="wax.MyFactoryBean"/> <bean id="factoryBeanUser" class="wax.FactoryBeanUser"> <!-- what should be placed here?--> </bean> </beans> I have instance of FactoryBean implementation and some other instance. I need Spring to inject to other instance FactoryBean , not the object it produces. There are two possible ways to solve it. First one, obvious and malfunctional: <bean id="factoryBeanUser" class="wax.FactoryBeanUser"> <property name="myFactoryBean" ref="&theFactoryBean"/> </bean> With this config Spring throws following exception on start: [skipped irrelevant part] Caused by: org.xml.sax.SAXParseException: The reference to entity "theFactoryBean" must end with the ';' delimiter. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388) at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1414) I found this solution Spring: Getting FactoryBean object instead of FactoryBean.getObject() , this question is maked as answered and four people
Tags (comma-separated)
Save Edits
Cancel