aspose file tools*
The moose likes Spring and the fly likes Basic Spring Doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Basic Spring Doubt" Watch "Basic Spring Doubt" New topic
Author

Basic Spring Doubt

Dhanesh Rote
Greenhorn

Joined: Sep 29, 2005
Posts: 3
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

Joined: Mar 10, 2008
Posts: 1779
    
    7

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?

Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Dhanesh Rote
Greenhorn

Joined: Sep 29, 2005
Posts: 3
Thanks. Got it..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Basic Spring Doubt