sergek
Jan 22nd, 2005, 05:33 PM
I'm migrating from my hand-glued IoC beans to using the Spring framework. I have this one bean that retrieves emails, processes them, and stores them (for archival purposes) in a directory under my WEB-INF/archive path.
In my current glue code, I do:
MyBean bean = new MyBean();
bean.setArchivePath(servletContext.getRealPath("/WEB-INF/archive"));
...
With Spring I'm using org.springframework.web.context.ContextLoaderListe ner to configure and load my beans from /WEB-INF/applicationContext.xml.
I can see how (programmatically) I can grab the servlet context, or even better move to the Spring's Resource API to reference the archive directory, and the WebApplicationContext will translate my path to the appropriate path, which is great.
However, I cannot figure out how to populate this bean value based on notation in my spring xml file. Is there some wrapper class or lookup notation to grab a resource and set it as my bean property?
In my current glue code, I do:
MyBean bean = new MyBean();
bean.setArchivePath(servletContext.getRealPath("/WEB-INF/archive"));
...
With Spring I'm using org.springframework.web.context.ContextLoaderListe ner to configure and load my beans from /WEB-INF/applicationContext.xml.
I can see how (programmatically) I can grab the servlet context, or even better move to the Spring's Resource API to reference the archive directory, and the WebApplicationContext will translate my path to the appropriate path, which is great.
However, I cannot figure out how to populate this bean value based on notation in my spring xml file. Is there some wrapper class or lookup notation to grab a resource and set it as my bean property?