SPRINGAOP interception Controller,service Implementing log Management (how to customize annotations)

Source: Internet
Author: User

First of all, why do we need to do log management, in the real-time on-line we often encounter system anomalies or problems. This time immediately open the CRT or SSH connected to the server to take the day to analyze. are subject to various limitations of the network. So we thought why not directly in the management background to view the information of the error. So the log management appeared.

Second, the personal feel that doing the best log management is AOP, and some people like to use interceptors. Yes, I'll focus on my implementation here.

AOP Some people say that the controller is not intercepted. Some people say they want to stop Annotationmethodhandleradapter, and the controller has to intercept Org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandl. Eradapter.

First, AOP can intercept the controller, which is no doubt that the second must intercept the annotationmethodhandleradapter is not necessary. At least I didn't prove it was successful. My spring version is 4.0.3.

AOP Some people say that the controller is not intercepted because the controller was the JDK agent. We just have to give it to the Cglib agent.

The first step defines two annotations:

It shows the addition of the incomplete method:

SPRINGAOP interception Controller,service Implementing log Management (how to customize annotations)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.