Annotation (note) briefly describes:Note the most impressive possibility is that JUnit does the unit test and uses it in various frameworks.This article mainly introduces the use of annotations, the next article further in-depth study.annotation does not directly affect code semantics. But it can be seen as a tool or class library of similar programs. This in turn has an impact on the program semantics being executed.Annotation can be read from source
1. Introduction
Annotations are a new feature that JavaSE5.0 provides to provide some descriptive narrative information to a program through a specific annotation tag.
These descriptive narrative information can provide additional information to the compiler and execution environment when compiling or executing. thus simplifying development.
2. Define your own annotations
in which beans are initialized and destroyed@Primary: When multiple bean candidates appear in automatic assembly, the Bean Annotated as @primary will be the preferred one, or an exception will be thrownThe @Autowired is assembled by type by default, and can be used in conjunction with @qualifier annotations if we want to use the assemble by name. As follows:@Autowired @Qualifier ("Persondaobean") exist with multiple instances@PostConstruct initializa
Reprint: http://www.jb51.net/article/75460.htm1. Using spring annotations to inject attributes1.1. How do we inject attributes before using annotations?Implementation of the class:Class Usermanagerimpl implements Usermanager { private Userdao Userdao; public void Setuserdao (Userdao userdao) { This.userdao = Userdao; } ... }Configuration file:1.2. Introduction of @autowired
I. What is an annotation:Annotations are tokens, or they can be interpreted as a special modifier applied to classes, methods, parameters, properties, and constructors. The annotations have the following three kinds of functions:The first type: Generate documents, commonly used @[email protected] and so on.Second: The role of the alternative configuration file, especially in some frameworks such as spring, the use of
Spring uses annotations for transaction managementSteps to use:Step one, introducing the Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xmlns:tx= "Http://www.springframework.org/schema/tx"Xsi:schemalocation= "Http://www.springframework.org/schema/beansHttp://www.springframework.org/schema/beans/spring-beans-2.0.xsdHttp://www.springframework.org/schema/txHttp://www.springframework.org/schema/tx/spring-tx-2.0.xsd ">Step two, beans with @transact
Java Annotations Annotation (i)--IntroductionThis chapter first briefly introduces the annotations, and the next chapter gives a demo of the application of annotations.1. Meta-annotationsThe role of meta-annotations is to be responsible for annotating other annotations.In JDK1.5, 4 standard meta-annotation annotation t
Transferred from: https://asce1885.gitbooks.io/android-rd-senior-advanced/content/shen_ru_qian_chu_android_support_annotations.htmlOriginal link: http://anupcowkur.com/posts/a-look-at-android-support-annotations/In the Android support Library19.1 release, the Android tools team introduced several cool annotation types for developers to use in the project. The support library itself also uses these annotations
Starting with JDK 5.0, Java added support for meta data (MetaData), which is Annotation (annotations)Annotation is actually a special tag in the code that can be read at compile, class load, run time, and perform the appropriate processing. By using Annotation, programmers can embed some supplemental information in the source file without changing the original logic.Annotation can be used like modifiers, which can be used to modify the declarations of
annotations
Optional value: Retentionpolicy.source (source time), Retentionpolicy.class (compile time), Retentionpolicy.runtime (runtime)
@ Target
Used to specify which program elements the annotations can decorate
Selectable values: Elementtype.type, Elementtype.method, Elementtype.constructor, Elementtype.field, Elementtype.parameter, etc.
@ Inh
1 customizing annotations 1.1 creating custom annotationsCustom annotations can be defined using @interface starting from Java5Tip 01: Annotations Do not directly interfere with the operation of the program code (i.e., the code will function correctly after adding and deleting annotations)Tip:@Retention used to declare
http://www.jb51.net/article/55371.htmhttp://www.cnblogs.com/peida/archive/2013/04/24/3036689.html Retention annotations retention (reserved) Note that this type of annotation is retained at that stage. There are three values: 1.retentionpolicy.source--This type of annotations is only preserved at the source level and is ignored at compile time by 2. retentionpolicy.class--This type of
Original: http://www.cnblogs.com/peida/archive/2013/04/24/3036689.html.Meta-Annotations:The role of meta annotations is to be responsible for annotating other annotations. Java5.0 defines 4 standard meta-annotation types, which are used to provide descriptions of other annotation types. Java5.0 defined meta-annotations:[Email protected],[Email protected],[Email p
In Microsoft Office Excel 2007, you can add a comment to a cell by inserting an annotation. You can edit the text in the annotation, or you can delete the annotations that you no longer need.
Add annotations
1, click the cell that you want to add the annotation to.
2, on the Review tab, in the Comments group, click New Annotation.
3, in the Annotation text box, type the annotation text.
Note in
The main contents of this section:1: How to get Configuration items in a configuration file in a non-annotated way2: Use annotations to Get External properties file configuration itemsStatement:This article is an important note for the Spring boot framework to learn preschool Mastery (3)-Read the external resource profile by annotating the Edith accompany you learn series-Framework learning Spring boot Framework learning. You are welcome to commentOne
Java Annotations and ReflectionsIn Java, four kinds of meta-annotations are provided, which are specifically responsible for annotating other annotations, as follows1, @Retention meta-annotations, indicating the level at which the annotation information (life cycle) needs to be saved. The optional retentionpoicy parame
Summary of SPRINGMVC annotations@Configuration use a class as an IOC container, and one of its method headers, if registered with @bean, is used as the Bean in the spring container.@Scope Annotation Scopes@Lazy (True) indicates deferred initialization@Service for labeling business layer components,@Controller for labeling control-layer components, such as action in struts@Repository is used to label data access Components, or DAO components.@Component
In the development of the model layer in ASP. MVC5, the data annotations used have three functions:
Data mapping (Maps the class of the model layer to the corresponding table using EntityFramework)
Data validation (validation of data on server side and client)
Data display (displays the corresponding data in the view layer)
The following namespaces relate to data annotations:
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.