Announcement Announcement Module
Collapse

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions (http://www.springsource.org/extensions) project, this forum has been decommissioned in favour of Spring Extensions one at:
http://forum.springsource.org/forumdisplay.php?f=44

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Cheers,
Costin Leau
SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
http://twitter.com/costinl
See more
See less
A basic question on bean creation. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • A basic question on bean creation.

    I have one fundamental question on dependency injection.

    Assuming I have two beans definition

    Code:
    <bean id="SessionFactory"
    		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"
    		scope="singleton" lazy-init="false">
    <bean/>
    Code:
    	<bean id="ObjectMain"
    		class="com.test.testSpring"
    		scope="prototype" autowire="constructor" lazy-init="false">
    		<constructor-arg index="0" value="SessionFactory" />
    	</bean>
    Now if this class testSpring object is created using the getBean call of the ClassPathXMLApplicationContext and if there are two constructor one with no parameters and one with SpringFactory as a parameter which one shall be called?

    I am asking this coz I have tried Autowiring the overloaded constructor with the SessionFactory object as
    HTML Code:
    required=true
    it still does not calls the overloaded constructor.

    Any help?

  • #2
    I found the issue there. I was loading the wrong XML an had used annotation as well, so it was defaulting to annotation where in there was no definition of the injected bean.

    Thanks, anyways!

    Comment

    Working...
    X