Skip to content

Reloading the spring context does not refresh the MessageDispatcherServlet [SWS-718] #700

@gregturn

Description

@gregturn

Johan Gorter opened SWS-718 and commented

Our application uses a special classloader from which it can load beans dynamically. The applicationcontext is reloaded to do this. The normal DispatcherServlet has a mechanism to allow the applicationcontext to be reloaded by overriding the onRefresh method. The MessageDispatcherServlet does not do this and crashes occur when webservices are invoked.

The class below can be used as a workaround.

public class FixedMessageDispatcherServlet
	extends MessageDispatcherServlet
{

	private boolean initializing = true;

	@Override
	protected void onRefresh(ApplicationContext context)
	{
		try {
			if (this.initializing) {
				this.initializing = false;
			} else {
				this.initFrameworkServlet();
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
}

Affects: 2.0.2

Referenced from: commits 4b89c40

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions