Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Basic Spring Doubt

 
Dhanesh Rote
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ,
I have following two beans in the xml context. I want to know whether the underlying objects denoted by these 2 beans remains the same or different? In case of String its the same one. What about with spring? Can anybody let me know on this...


<bean id="ftpConnector1"
class="com.service.integ.transport.FtpConnectorCommonsNetImpl">
<property name="ftpUser">
<value>${ftp.provisioning.user}</value>
</property>
<property name="ftpPassword">
<value>${ftp.provisioning.password}</value>
</property>
<property name="ftpServer">
<value>${ftp.provisioning.host}</value>
</property>
</bean>


<bean id="ftpConnector2"
class="com.service.integ.transport.FtpConnectorCommonsNetImpl">
<property name="ftpUser">
<value>${ftp.provisioning.user}</value>
</property>
<property name="ftpPassword">
<value>${ftp.provisioning.password}</value>
</property>
<property name="ftpServer">
<value>${ftp.provisioning.host}</value>
</property>
</bean>

 
Jelle Klap
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, welcome to JavaRanch!

If you define two beans of the same type, each with the default singleton scope, then two distinct instances of that type will be registered with Spring's IoC container.
It can be a cause of some headaches if you auto-wire your beans by type, though.
Does that answer your question?
 
Dhanesh Rote
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. Got it..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic