is there some simple way to inject Properties class loaded with a file from the classpath into EJB (3.1)?
Something like this:
@Resource(name="filename.properties", loader=some.properties.loader)
private Properties someProperties;
Thank you,
Bozo
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As bkail said, you can achieve this in the following way. I am not sure what your
loader=some.properties.loaderreally meant, so skipped doing anything with that, but provided option for that in case you want to load using theloader.getClass().getResourceAsStream ("filename.properties");First define your injection type
Then create a producer for that
Then inject it into your Named component.
I did this looking into the weld documentation where the @HttpParam is given as an example here. This is as per weld 1.1.0, in weld 1.0.0, the getting annotation can be done like this