Is it possible to use different view resolvers?

Solution 1:

You absolutely can. ViewResolver has a single method, resolveViewName(String) which returns

the View object, or null if not found (optional, to allow for ViewResolver chaining)

Your ViewResolver beans are registered. When a view name is returned by a handler, Spring will iterate through each ViewResolver, invoking their resolveViewName method with the given name. If the method returns non-null, that View is used. If null is returned, then it continues iterating.

So the implementation has to return null if Spring is to skip it.

There are some implementations that never return null. This seems to be the case with your custom ViewResolver classes. If the ViewResolver returns a View, even if that View will eventually fail to be rendered, Spring will use it.

You either need to fix that or order your ViewResolver beans. For example, you can order them with the Ordered interface. Have your classes implement that interface and return an appropriate value.