Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Spring FrameWork: How to pass InputStream while initializing bean

898032Jun 12 2012 — edited Jun 12 2012
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.UnsatisfiedDependencyException: 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 10 2012
Added on Jun 12 2012
2 comments
533 views