Learn about spring boot annotations list with explanation, we have the largest and most updated spring boot annotations list with explanation information on alibabacloud.com
package. Otherwise, you need to add a scan package path.Automatic scanning: @Repository, @Service, @Controller, @Component components.@Repository, @Service, @Controller, @ComponentComponent annotations: Use @component in annotaion configuration annotations to denote a generic comment that describes a class as a spring container-managed class. That is, the class
@Conditional creates a specific bean based on satisfying a particular condition (the creation of a condition-based bean, i.e., the use of @conditional annotations).For example, when a jar is wrapped in the path of a class, it automatically configures one or more beans, or only one bean is created to create another bean.By implementing the condition interface and rewriting the period matches method to construct the judging condition. If the Windows sys
Spring boot can use @valid to verify when the post accepts an object parameter, as in the following codeWhen you create a user classThe above @notblank and @past made a judgment on how to do similar annotations to validate the dataTo create an Myconstraint interface@Retention: Used to describe the life cycle of the annotation class. It has the following three par
1. Overview
This article describes how spring boot uses Redis for caching, how to customize the Redis cache (such as key expiration), and how spring boot initializes redis cache. Use specific code to introduce annotations such as @cacheable, @CacheEvict, @CachePut, @CacheCo
value of the function directly into the HTTP response body.Note: The Restcontroller and requestmapping annotations are spring MVC annotations, not a specific part of spring boot.@EnableAutoConfiguration This note tells spring
to tune up so I built a new interceptor, inherit Cacheinterceptor: @Override protected Object execute(CacheOperationInvoker invoker, Object target, Method method, Object[] args) { try { return super.execute(invoker, target, method, args); }catch (Exception e){ return invokeOperation(invoker); } }And then just let the new interceptor work, and I hate Springboot's annotations in this part. If you still use enablecaching
Common annotations for Controller@Controller Handling HTTP Requests@RestController Spring4 after the new annotation, the original return JSON data need @responsebody mate @controller, now merged into @restcontroller@RequestMapping Configure URL mapping, value configuration URL method path, methods configuration request method, example:@RequestMapping (value= "Hello", method = Requestmethod.get)@PathVariableGets the data in the URL, the URL of the r
, etc.
@Entity annotations This is an entity class.
@Table Note Table related, such as aliases, etc.
@Id annotation primary key, @GeneratedValue means auto-generated
@DynamicUpdate, @DynamicInsert annotations generate INSERT, UPDATE statements dynamically, and all updates are generated by default
@Column identifies some field attributes, the field alias, whether it is allowed to be empty, whether it is uniq
Original: http://www.cnblogs.com/azhqiang/p/5609615.htmlThe meaning of Enableasync annotation is that it can be executed asynchronously, that is, to turn on multithreading. Can be labeled on methods, classes.1 @Component2 Public classTask {3 4 @Async5 Public voidDotaskone ()throwsException {6 //Above content, omitted7 }8 9 @AsyncTen Public voidDotasktwo ()throwsException { One //Above content, omitted A } - - @Async the Public voidDotaskthree ()throwsExce
A strange thing happened today:In the Springboot control class, the response path "/hello" uses @requestmapping annotations to be accessed normally.@RequestMapping (value = "/hello", method = requestmethod.get) public String Hello (model model) { Model.addattribute ("name", "Dear"); return "Hello"; }Shown below:However, if you add another response path to the same type using the @getmapping annotation, the access error will be rais
Use mail to do the example. The configuration is placed in the Mail.properties file. The property must be named for the specification to bind successfully.Spring Boot uses some loose rules to bind attributes to the @ConfigurationProperties bean and supports a hierarchical structure (hierarchical structure).To start creating a @ConfigurationProperties bean:@ConfigurationProperties(locations = "classpath:mail.properties", ignore
Importorg.springframework.boot.autoconfigure.condition.*; @ConditionalOnBean//when the container has the specified bean in the condition@ConditionalOnClass//when the class path has the specified class under the condition@ConditionalOnExpression//based on Spel expression as the judging condition@ConditionalOnJava//based on the JVM version as the judging condition@ConditionalOnJndi//find the specified location under the conditions of Jndi presence@ConditionalOnMissingBean//when a bean is not speci
The entity mappings in Spring-data-mongodb are implemented by Mongomappingconverter this class. It can be annotated to convert the Java class to a MongoDB document.It has the following types of comments:@Id-The unique identification of the document, which is unique in MongoDB, is the only one that consists of a timestamp + machine ID + process id+ self-increment counter (to ensure that the Id generated in the same second does not conflict) is Objectid
1,spring the location of the boot entry class (class with Main class)The location of the Springboot entry class is placed in a package higher than the regular class, so that the project can be loaded into each Java configuration class under the package path when it is started.1,spring boot Annotations1, @RestController
@EnableAutoConfigurationWith this annotation, spring boot will guess what kind of spring application you will be developing based on the jar dependencies in Classpat. For example: Spring-boot-starter-web this dependency, then Springboot will automatically embed the relevant
Say in front:
The spring boot has also been a preliminary understanding, but spring boot is also a lot of application module POM configuration, and so on a series of things, need to remember
Make a record so you can look back when you don't remember.
1. Spring
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.