Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support injecting resource as Reader [SPR-12876] #17474

Closed
spring-issuemaster opened this issue Apr 1, 2015 · 1 comment

Comments

@spring-issuemaster
Copy link
Collaborator

commented Apr 1, 2015

Christopher Smith opened SPR-12876 and commented

I am using the ability to inject an InputStream from the classpath, a la

@Autowired
MyConstructor(@Value('classpath:foo.csv') InputStream csv)

It would be convenient to be able to work with the resource as a Reader instead of an InputStream, but Spring doesn't know how to translate the string value into a Reader. Would it be feasible to have the conversion system understand how to wrap an InputStreamReader around the injected resource?


Affects: 4.1.5

Referenced from: commits 2c637dc

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 1, 2015

Juergen Hoeller commented

I'd recommend using EncodedResource for that purpose, created from an injected Resource, but when you're ok with the default charset, injecting a Reader is alright too. Addressed for 4.2 now.

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.