ApplicationContext.xml at individual class level
Hello Spring experts
You can tell I am new to spring FW from my post.
Is it possible to configure applicationContext.xml (basically context configuration file) at a class level or a servlet level in a web application? Like how we can configure mvc config file per servlet in web.xml.
What I am trying to do is
I have a service impl class and I am setting its property via applicationContext.xml bean definition.
<bean id="genericSupportService" class="com.xyz.genric.GenericSupportServiceImpl">
<property name="wsConfigUrl" value="a/b/c" />
I have 2 servlets. When the request comes thru servlet 1, the value of a/b/c is perfectly fine.
But for requests routed thru servlet 2, I want the same property wsConfigUrl to assume d/e/f.
I can use setters and keep changing the value back and forth between a/b/c and d/e/f but dont think it is an elegant solution. At the same time I think bean scope being prototype is also an overkill. Ideally I think I want to load one bean per servlet with different values using different configurations.
Hope I made sense with my question. Greatly appreaciate any insight.
Thanks