ServletContextAwareProcessor is not being invoked on TilesConfigurer

13 Views Asked by At

I am trying to update an application that uses Apache Tiles from Struts MVC to Spring MVC. I am getting a NullPointerException, and I stepped through the debugger to find the cause is that the servletContext field in the TilesConfigurer bean is null. After further research, I found that this field is populated by the ServletContextAwareProcessor, which is supposed to be called automatically on any bean that implements the ServletContextAware interface (which TilesConfigurer does). I stepped through all the BeanPostProcessors and it seems this is not being applied.

I am using Tiles 3 and Spring 3.2.18. My spring-servlet.xml looks like this:

    <bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
        <property name="definitions">
            <list>
                <value>/WEB-INF/tiles-config/tiles-defs.xml</value>
            </list>
        </property>
    </bean>

I have tiles-extras on my pom, which I read in a different post could cause this issue.

UPDATE: I keep digging, and it seems like the reason ServletContextAwareProcessor is not being applied is because Spring is using ClassPathXmlApplicationContext, which does not apply that post-processor at all. How can I change what application context spring is using?

0

There are 0 best solutions below