Audit Java: system to detect exceptions thrown / caught (aop?)

后端 未结 6 1425
广开言路
广开言路 2021-02-07 08:56

Due to checked exceptions, we can have some problems in production having all exceptions caught in the right place and logged correctly.

I wonder if there is some openso

6条回答
  •  我在风中等你
    2021-02-07 09:12

    If you've decided that you would like to take the AOP route, the Spring Framework provides an easy to use AOP framework. Essentially, like much of Spring, you would use a combination of a xml config file and some java code to define the AOP functionality you are looking for.

    In your case, I believe you would be looking to define an 'After Throwing Advice', in which you would of course have access to the exception thrown.

    A good place to start in terms of documentation is the AOP Chapter in the Spring docs: http://static.springsource.org/spring/docs/2.5.x/reference/aop.html

    Oh, and I believe all Spring projects are open source as well =)

提交回复
热议问题