Announcement Announcement Module

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions ( project, this forum has been decommissioned in favour of Spring Extensions one at:

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.

Costin Leau
SpringSource - Spring Training, Consulting, and Support - "From the Source"
See more
See less
A basic question on bean creation. Page Title Module
Move Remove Collapse
Conversation Detail Module
  • 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

    <bean id="SessionFactory"
    		scope="singleton" lazy-init="false">
    	<bean id="ObjectMain"
    		scope="prototype" autowire="constructor" lazy-init="false">
    		<constructor-arg index="0" value="SessionFactory" />
    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:
    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!