在Spring常用的注解
自动装配
@Autowired:自动装配通过类型、名字
如果Autowired不能唯一自动装配属性,则需通过@Qualifier(value="")
@Nullable:字段标记了这个注解,说明这个字段可以为null
@Resource:自动装配通过名字、类型
注册到spring中,装配到Bean
@Component:用于注释实体类中
@Repository:用于注解dao层中
@Service:用于注解service层中
@Controller:用于注解controller层中
作用域
@Scope:当值为singleton表示单例模式,当值为prototype是表示多例模式。