How to exclude a specific package from @ControllerAdvice?

Viewed 688

I want to know how can we exclude specific package from @ControllerAdvice.

That the errors thrown by the classes of that specific package should not be handled.

1 Answers

You can set @ControllerAdvice to work on specific package via :

@ControllerAdvice(basePackages={"my.pkg.a", "my.pkg.b"})

Don't mention the package that you want to ignore. There is no option for excluding a specific package, but for including is there.

Related