Affects: 5.2.9


The example uses ac.refresh(); but throws an exception. Everything works perfectly without it.

Comment From: bclozel

Could you give us a bit more information? I don't know where that line comes from (could you provide a URL?) nor what the exception is. If it's a simple typo, a pull request fixing that problem would be very welcome.

Comment From: sbrannen

I think the issue is that the WebApplicationContext created in the MyWebApplicationInitializer example in webmvc.adoc should not actually invoke refresh() on the application context, since refresh occurs later -- for example, in org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(...).

The example in the class-level Javadoc for WebApplicationInitializer also does not invoke refresh() on the created application context.

@chereshnyabtw, is that what you are referring to?

Comment From: chrshnv

I mean, spring-mvc can't get servlet context with ac.refresh().

Comment From: rstoyanchev

Indeed, as per the Javadoc, refresh should not be called unless the application has done all the initialization that the constructor would do, or otherwise if it is refreshed it is assumed it has been done.