Announcement Announcement Module
Collapse
No announcement yet.
Spring FrameWork: How to pass InputStream while initializing bean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring FrameWork: How to pass InputStream while initializing bean

    I have a bean class: HelloWorld.java with this constructor

    ...

    public HelloWorld(InputStream is){
    //Do SOMETHING!!
    }

    ...

    i have a config xml that has

    <bean id="SpringHelloWorldBean"
    class="com.utd.greet.HelloWorld">
    <constructor-arg value="<<what-should-i-give-here>>/test.properties" type="java.io.InputStream">
    </constructor-arg>
    </bean>

    I am getting following error:

    org.springframework.beans.factory.UnsatisfiedDepen dencyException: Error creating bean with name 'SpringHelloWorldBean' defined in class path resource [SpringHelloWorld.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [java.lang.String]: Ambiguous constructor argument types - did you specify the correct bean references as constructor arguments?

    Any help would be appreciated!

    PEACE,
    Sandeep
Working...
X