search

Home  >  Q&A  >  body text

java - spring aop层报错会影响,主程序运行吗?

我遇到aop层代码,报错了,主程序本来没有错,但因为aop层报错,直接导致主程序被终止.目前问题代码已经解决,但不知道是什么原理或者原因

高洛峰高洛峰2813 days ago1179

reply all(2)I'll reply

  • 黄舟

    黄舟2017-04-17 17:34:21

    AOP essentially uses proxies or bytecode addition technology to add new business logic to the business logic in three ways: pre-positioning, post-positioning, and wrapping, without having to immerse in the original business logic when writing code. Runtime exceptions in the AOP interceptor will directly affect the processing of the original business logic.

    If you want to avoid exceptions in the AOP code without affecting the main business logic, you only need to use try...catch in the AOP code for packaging.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 17:34:21

    If there is a synchronous operation in aop, if an exception occurs and is not caught, it will affect the main program.

    reply
    0
  • Cancelreply