Commonly used annotations in learning (to be updated)
(Note: This article collects some information from other bloggers for your own learning and use. If there are any mistakes, please comment and correct them)
one. springboot
1.Annotations of Application class
Mapperscan: scan mapper package
springbootApplication: is the core annotation of the Sprnig Boot project, the purpose is to enable automatic configuration
2. Add the bean of the ioc container
@Qualifier:
3.@RestController 和@RequestMapping(“/boots”)
4. Test
4.1
@RunWith(SpringRunner.class)
If the Test test class in the Spring project uses injected classes, such as @Autowired injected classes or spring-managed beans, the spring container needs to be run before the test class is run, and this @RunWith(SpringRunner.class ) annotation is to run the spring container first and then start running the test class.
5. Some notes collected by the website
6.@ConfigurationProperties
7.@EnableAutoConfiguration(): Instantiate classes in dependent packages
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}): Instantiate the DataSource class
8. Some notes on pojo
@AllArgsConstructor: Automatically generate parameterized constructor
@NoArgsConstructor: Automatically generate parameterized constructor
@Data: Automatically generate get and set methods
two. other
1.servlet configuration path @webservlet
three. SSM
1. Relevant understanding of aop
2. Exception interception annotations
3. Various annotations for configuration classes
@Configuration: Add the desired component to the container and tell spring that this is a configuration class
@PropertySource("classpath:db.properties"): Connect the configuration file
@Import({jdbcConfig.class, mybatisConfig.class}): Import class
@EnableAspectJAutoProxy //Annotation development aop
4.@Bean
5.Springmvc
@EnableWebMvc: is an annotation that uses Java annotations to quickly configure Spring Webmvc
3.MapperScan: mapper package scan
四.Springcloud
1.@RefreshScope: nacos configuration hot update
2. @Slf4j
The annotation is equivalent to private final Logger logger = LoggerFactory.getLogger(current class name.class);
Then the function of the code is the same: it is to initialize the log object using the specified class. When the log is output, the class where the log information is located can be printed out.