> For the complete documentation index, see [llms.txt](https://spring-boot.shujuwajue.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://spring-boot.shujuwajue.com/fu-lu-zhu-jie-bi-ji.md).

# 附录:注解笔记

## @Configuration

[@Configuration的使用](https://www.cnblogs.com/duanxz/p/7493276.html)

从Spring3.0，@Configuration用于定义配置类，可替换xml配置文件，被注解的类内部包含有一个或多个被@Bean注解的方法，这些方法将会被AnnotationConfigApplicationContext或AnnotationConfigWebApplicationContext类进行扫描，并用于构建bean定义，初始化Spring容器。

配合@Configuration使用，包括 @EnableAsync, @EnableScheduling, @EnableTransactionManagement, @EnableAspectJAutoProxy, @EnableWebMvc。

## @EnableAsync

[@EnableAsync 使用规范](https://www.cnblogs.com/bfyq/p/10845700.html)

自定义线程池的配置类，并在类上添加@EnableAsync 注解，然后在需要异步的方法上使用@Async("线程池名称") 该方法就可以异步执行了。

## @Autowired

[@Autowired用法详解](https://www.cnblogs.com/fnlingnzb-learner/p/9723834.html)

@Autowired 注释，它可以对类成员变量、方法及构造函数进行标注，完成自动装配的工作。

@bean 负责向IoC注册,@Autowired负责根据相同的名字从IoC里取.

## @service

[springMVC的@service("serviceName")注解](https://my.oschina.net/u/3847203/blog/1814962/)

1、@service("serviceName")： 表示给当前类命名一个别名，方便注入到其他类中；

2、@service：不加的话，默认别名就是当前类名，但是首字母小写

3、这些注解都是Bean，Spring容器托管

* 持久层：@Repository&#x20;
* 业务层：@Service&#x20;
* 控制层：@Controller&#x20;
* 中立类：@Component （对那些比较中立的类进行注释）
