如何从@ControllerAdvice中排除特定的包?

huangapple go评论65阅读模式
英文:

How to exclude a specific package from @ControllerAdvice?

问题

我想知道如何从 @ControllerAdvice 中排除特定软件包。

该特定软件包的类抛出的错误不应该被处理。

英文:

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

得分: 2

你可以通过以下方式将 @ControllerAdvice 应用于特定包:

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

不要提及要忽略的包名。
没有针对排除特定包的选项,但可以用于包含。

英文:

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.

huangapple
  • 本文由 发表于 2020年9月11日 16:19:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/63843346.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定