0

Hi ..

I try to override the XmlWebApplicationsContext and I dont know how to register my subclass. I found in ContextLoader.java in the method determineContextClass the following code:

String contextClassame = servletContext.getInitParameter(CONTEXT_CLASS_PARAM);

I looks like I could set the class by setting this Parameter but I down know how.

In de documentation (http://ajava.org/online/spring-3.RC2-api/org/springframework/web/context/support/XmlWebApplicationContext.html), I see the following line:

For a WebApplicationContext that reads in a different bean definition format, create an analogous subclass of AbstractRefreshableWebApplicationContext. Such a context implementation can be specified as "contextClass" context-param for ContextLoader or "contextClass" init-param for FrameworkServlet.

But this does not really help me. I still dont know hat to register my subclass. Does anyone?

Thanks für every answer!

Dominic

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by ~s.o.s~
0

But this does not really help me. I still dont know hat to register my subclass. Does anyone?

The same way you would register the Spring XML configuration file. In your web.xml along with specifying the context configuration location, also specify your context loader class. Something like:

<context-param>
	<param-name>contextClass</param-name>
	<param-value>net.sos.services.common.MyLoader</param-value>
</context-param>
<context-param>
	<param-name>contextConfigLocation</param-name>
	<param-value>classpath:net/sos/services/config/cxf.xml</param-value>
</context-param>

Here net.sos.services.common.MyLoader is a class which extends the AbstractRefreshableWebApplicationContext class.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.