@Autowired Automatic injection ( There are multiple injectable Bean when , adopt @Qualifier Appoint )
@Resource And @Autowired The same effect
@Repository Can only be marked on DAO Class . The purpose of this annotation is not just to identify a class as Bean, At the same time, it can encapsulate the data access exception thrown in the annotated class as Spring Data access exception type for
@Component It's a general concept , Represents only one component (Bean) , Can work at any level .
@Service Usually at the business level , But at present, this function is similar to @Component identical .
@Constroller It usually acts on the control layer , But at present, this function is similar to @Component identical .
@Scope Appoint Bean The scope of action of

@SpringBootApplication:
contain @Configuration、@EnableAutoConfiguration、@ComponentScan
Usually used on the main class .

@RestController:
Used to label control layer components ( Such as struts Medium action), contain @Controller and @ResponseBody.

@ResponseBody:
Indicates that the return result of the method is written directly to HTTP response body in
Typically used when fetching data asynchronously , In the use of @RequestMapping after , The return value is usually resolved as a jump path , add

@responsebody The return result is not parsed as a jump path , I'm just going to write HTTP response body in . such as
Asynchronous acquisition json data , add @responsebody after , Will go straight back to json data .

@ComponentScan:
Component scan . Personal understanding is equivalent to <context:component-scan>, If there is @Component 
@Controller@Service Wait for these annotated classes , Then register these classes as bean.

@Configuration:
It is pointed out that this class is Bean Configured information sources , amount to XML Medium <beans></beans>, It is generally added to the main class .

@Bean:
amount to XML Medium <bean></bean>, Put it on top of the method , Rather than class , It means to produce a bean, And to spring
management .

@EnableAutoConfiguration:
Give Way Spring Boot Depend on the dependencies declared by the application Spring The framework is automatically configured , It is generally added to the main class .

2.Jpa

@Entity:
@Table(name=""):
Indicates that this is an entity class . Commonly used in jpa
These two annotations are usually used together , But if the table name and the entity class name are the same ,@Table It can be omitted

@MappedSuperClass:

Used to determine whether it is a parent class entity On . The property subclass of the parent class can inherit .

@NoRepositoryBean:

Usually used as a parent repository, There's this note ,spring Will not instantiate the repository.

@Column:
If the field name is the same as the column name , You can omit .

@Id:
Indicates that the property is a primary key .

@GeneratedValue(strategy = GenerationType.SEQUENCE,generator = "repair_seq"):
Indicates that the primary key generation strategy is sequence( It can be for Auto、IDENTITY、native etc. ,Auto It can be used between multiple databases
Switch ), Appoint sequence The name of is repair_seq.

@SequenceGeneretor(name = "repair_seq", sequenceName = "seq_repair", allocationSize = 1)
name by sequence The name of , For use ,sequenceName For database sequence name , The two names can be the same .

@Transient:
Indicates that the property is not a field mapping to a database table ,ORM The framework will ignore this property .
If a property is not a field mapping of a database table , It must be marked as @Transient, otherwise ,ORM The default annotation of the frame is @Basic

@Basic(fetch=FetchType.LAZY):
Tags can specify how entity properties are loaded

@JsonIgnore:
Role is json Serialization will java bean Some properties in are ignored , Both serialization and deserialization are affected .

@JoinColumn(name="loginId"):
one-on-one : Foreign key in this table pointing to another table .
One to many : Another table points to the foreign key of this table .

@OneToOne
@OneToMany
@ManyToOne
Corresponding Hibernate One to one in the configuration file , One to many , For one more .

---------------------------------------------------------------------
SpringMVC
@RequestMapping:
RequestMapping Is an annotation used to process the request address mapping , Can be used on a class or method . For classes , This address is the parent path of all methods in the class that respond to requests .
The annotation has six attributes :
params: Appoint request Some parameter values must be included in , To be handled by this method .
headers: Appoint request Some of the specified header value , To have the method process the request .
value: Specify the actual address of the request , The specified address can be URI Template Pattern
method: Specify the requested method type , GET、POST、PUT、DELETE etc.
consumes: Specifies the submitted content type to process the request (Content-Type), Such as application/json,text/html;
produces: Specify the type of content returned , Only when the request In the request header (Accept) The specified type is included in the type to return

@RequestParam:
Before the parameters of the method .
@RequestParam String a =request.getParameter("a").

@PathVariable:
Path variable .
Such as RequestMapping("user/get/mac/{macAddress}")
public String getByMacAddress(@PathVariable String macAddress){
//do something;
}
Parameters are the same as the names in braces

@ControllerAdvice:
contain @Component. Can be scanned to . Unified handling of exceptions .
@ExceptionHandler(Exception.class):
Use above the method to indicate that if you encounter this exception, execute the following methods .

Spring More related articles on annotated encyclopedia

  1. Spring A complete set of annotations , Summary version

    Spring Notes and explanations used annotation explain @Controller Combine notes ( Combined @Component annotation ), Apply to MVC layer ( Control layer ),DispatcherServlet Will automatically scan the annotated class ...

  2. Spring Annotation and explanation

    Spring Notes and explanations used annotation explain @Controller Combine notes ( Combined @Component annotation ), Apply to MVC layer ( Control layer ),DispatcherServlet Will automatically scan the annotated class ...

  3. [ turn ]Spring Annotation and explanation

    Spring Notes and explanations used annotation explain @Controller Combine notes ( Combined @Component annotation ), Apply to MVC layer ( Control layer ),DispatcherServlet Will automatically scan the annotated class ...

  4. spring A complete set of annotations

    come from http://www.cnblogs.com/xiaoxi/p/5935009.html 1.@Autowired @Autowired seeing the name of a thing one thinks of its function , It's automatic assembly , Its purpose is to eliminate code Java In the code ...

  5. Spring Boot A complete set of annotations , One click collection !

    This article was first published on WeChat public [ Ape Lighthouse ], Please state the source of the quotation Today is the ape lighthouse “365 God original plan ” The first 5 God . What about today ! The lighthouse tells you : Spring Boot A complete set of annotations One . annotation (annotations) list @Spr ...

  6. springBoot series --&gt;springBoot A complete set of annotations

    One . annotation (annotations) list @SpringBootApplication: Contains @ComponentScan.@Configuration and @EnableAutoConfiguration ...

  7. SpringBoot A complete set of annotations ( turn )

    Link to the original text :[springBoot series ]--springBoot A complete set of annotations One . annotation (annotations) list  @SpringBootApplication: Contains @ComponentScan.@Co ...

  8. SpringBoot Advanced tutorial ( sixty-four ) A complete set of annotations

    stay Spring1.x Time , There's no comment yet , Need a lot of xml Configure files and write lots of them internally bean label .Java5 Launch new features annotation, by spring The renewal of the has laid the foundation for . from Spring 2.X Start spri ...

  9. spring Annotate source code analysis --how does autowired works?

    1. background Annotations can reduce the amount of code development ,spring Provides rich annotation functions . We may be asked ,spring What triggered the annotation of ? Today with spring One of the most commonly used annotations autowired To track the code , Conduct d ...

Random recommendation

  1. It's Saturday again -MySQL Special training

    hi It's Saturday again , Another morning of dawdling ~ Let's start after lunch 1.MySQL ----- Subquery and join ( 3、 ... and )----- ---- Use INSERT...SELECT insert record -- The English version of the database content Because of my WAMP in ...

  2. The most popular explanation of matrix - Super classic zz

    Linear Algebra , Whether you start with determinants or directly with matrices , From the beginning, it was full of inexplicable . for instance , Tongji linear algebra is the most widely used teaching material in the teaching of general engineering colleges and departments in China ( Now it's the fourth edition ), As soon as I come up, I will introduce the inverse ordinal number “ Have no predecessors , No latecomers ...

  3. Android Third party authorization (QQ piece )

    QQ Authorization is more convenient than wechat authorization Also need to go to the official website to download sdk And import sdk To your own project http://wiki.connect.qq.com/%E7%A7%BB%E5%8A%A8%E5%BA%94%E ...

  4. C# Planning tasks

    Planning tasks :   Personal understanding , Is the background control program requires a certain time to execute the corresponding task . Go straight to the code : Before , Because of work needs . Every day in the early morning 2:00, Execute the data to do 1.1   Declare an interface Ijob Method : perform ...

  5. [BZOJ]3243 Vector inner product (Noi2013)

    Small C It's one of the topics I feel very much after I do it , But because of the wrong posture for a long time . Description Two d Dimension vector A=[a1,a2,...,ad] And B=[b1,b2,...,bd] The inner product of is the product sum of the weights of its corresponding dimensions , namely ...

  6. .net analysis csv(C# Table guide tool )

    Preface analysis Excel There are famous ones NPOI library ,(Java Language is POI), however NPOI Parsing is not supported csv Of . csv It's essentially a text file , You can compare the differences , More conducive to conflict resolution . This paper analyzes csv Several .net The open source ...

  7. Reprint :[Java Face the ] Dry sorting , Java Interview questions ( Cover Java Basics ,Java senior ,JavaEE, database , Design mode, etc )

    original text :http://www.cnblogs.com/wang-meng/p/5898837.html One : Inherit . The difference between abstract classes and interfaces . Access control (private, public, protected, Default ) ...

  8. #ifndef HeaderName_h #define HeaderName_h #endif The use of, ( turn )

    original text :#ifndef HeaderName_h #define HeaderName_h #endif The use of, Many people must have seen it in the document :#ifndef HeaderName_h       ...

  9. 【php Add, delete, change and check the examples 】 Section 12 - Data deletion function

    1. Single data deletion Ideas : First , You need and can only allow users to check one piece of data , Then a confirmation box pops up , Ask the user if they really want to delete ? If it is , Just put ID Pass on to PHP, And then write a delete sentence , adopt ID Just delete it . After drawing the button , ...

  10. [PHP] Apply a callback function to the cells of a given array

    ---------------------------------------------------------------------------------------------------- ...