![](/img/trans.png)
[英]Will I have any collisions coming from the @ControllerAdvice if I use it to populate a @ModelAttribute
[英]Is there any way to use @ControllerAdvice on @Service
我有一个项目需求,我将没有任何@Controller
或@RestController
但是我需要为我的服务层提供一个全局异常处理程序,因此我需要在@Service
上配置@ControllerAdvice
,请告诉我是否有其他方法也可以做到这一点。
@ControllerAdvice
与Spring MVC控制器特别相关,因此您不能在任意bean上使用它。 您可能正在寻找的是使用@Aspect
的常规Spring AOP支持。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.