JAVA Common annotations (JDK, Spring, AspectJ)

Source: Internet
Author: User

JDK comes with annotations

@Override

means that the current method overrides the parent class

@Deprecation

Indicates that the method is obsolete , There is a horizontal line on the method, and a warning is used

@SuppviseWarnings

Indicates closing some warning messages ( notifies the Java compiler to ignore specific compilation warnings )

Spring Annotations

@Autowired

Spring Automatic Assembly

@Qualifier ("Javabea")

Automatic assembly with @Autowired

@Resource (name= "JavaBean")

Spring Automatic Assembly , without writing parameters directly assemble the same type of class

@PostConstruct

Methods for class initialization

@PreDestroy

Methods of class destruction

@Component

Table name class is JavaBean

@Scope ("prototype")

Specifies the scope of the Bean , prototype to re-instantiate each time

@Repository

Same as @Component , often used in data persistence layer

@Service

same as @Component , often used in the business Logic Layer

@Controller

same as @Component , often used to control the performance layer

AspectJ Annotations

@AspectJ

Declaring slice classes , working with @Component

@Before

Front notification (pointcut="")-- tangent expression

@AfterReturning

Return notification (pointcut="", returning= "")--( tangent expression , return value variable )

@AfterThrowing

Exception notification (pointcut="", throwing= "")--( tangent expression , exception variable )

@After

Post Notification (pointcut="")-- tangent expression

Tangent expression

Execution ( scope return value type full class name . ) Method Name () )

@Around

Surround Notification ( tangent expression )

@AspectJ

Introducing declarations to use in facets

@Poincut

Reusing a pointcut expression ( pointcut expression ), when used , notifies the pointcut="method name"

@Order

The priority ( number ) of the Slice class, the smaller the number , the higher the priority

JAVA Common annotations (JDK, Spring, AspectJ)

Related Article

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.