Skip to content

Cannot set custom ExceptionHandler #2245

@willfleury

Description

@willfleury

RestRepositoryMvcConfiguration.extendHandlerExceptionResolvers creates a new ExceptionHandlerExceptionResolver and sets it as the default. However, the ApplicationContext is not set on this resolver which means the resolver logic doesn't work (it can't find any beans required for resolution).

The fix is trivial - set the ApplicationContext on the ExceptionHandlerExceptionResolver. I've submitted a PR #2246

There is a temporary workaround and it is trivial. Implement RepositoryRestConfigurer and override

public void configureExceptionHandlerExceptionResolver(ExceptionHandlerExceptionResolver resolver) {
    resolver.setApplicationContext(ctx);
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions