Hi everyone,

I have the spring configuration below and I am trying to understand how come the repository property in both service1 and service2 are not the same as the singleRepository bean. But if I remove the 2 factory bean declarations from spring config file then all the repository instances are the same as I expected.

Thanks in advance.

<bean id="someService" class="org.springframework.aop.framework.ProxyFact oryBean">
<property name="proxyInterfaces">
<value>spring.Service1</value>
</property>
<property name="target">
<bean class="spring.Service1Wrapper">
<property name="service" ref="service1"/>
</bean>
</property>
</bean>
<bean id="anotherService" class="org.springframework.aop.framework.ProxyFact oryBean">
<property name="proxyInterfaces">
<value>spring.Service2</value>
</property>
<property name="target">
<bean class="spring.Service2Wrapper">
<property name="service" ref="service2"/>
</bean>
</property>
</bean>

<bean id="service1" class="spring.Service1">
<property name="repository" ref="singletonRepository"/>
</bean>

<bean id="service2" class="spring.Service2">
<property name="repository" ref="singletonRepository"/>
</bean>

<bean id="singletonRepository" class="spring.SingletonRepository" singleton="true">
<property name="hibernateTemplate" ref="hibernateTemplate"/>
</bean>