英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论