@Resource注释
@Resource
private AService aService;
This annotation may be applied to an application component class, or to fields or methods of the component class. When the annotation is applied to a field or method, the container will inject an instance of the requested resource into the application component when the component is initialized. If the annotation is applied to the component class, the annotation declares a resource that the application will look up at runtime.
1.给组件类注释:如Service类:声明一个应用程序在运行时会持续检查的资源;
2.给组件类的字段或者方法注释:当组件初始化的时候,容器会注入要求资源的实例到应用程序;