I'd like to have some property files available from an EJB. The EJB spec says not to access files using java.io from an EJB. Um ... OK. What are some practical solutions to this issue? I dislike user getResource() because (being classpath-based) it opens the door to configuration errors. "Oh you mean we're loading foo.properties from the classpath? I didn't realize that and added my own foo.properties to the classpath and it was loaded instead of the expected one". I like something more explicit.
posted 12 years ago
I think the preferred solution is to declare your properties in the EJB deployment descriptors in <env-entry> elements. I think if you called getResource or used the Preferences API in jdk1.4, that is still 'cheating' because I/O calls may still take place, even if you are not calling a file directly.