why @autowired is not working when I access a bean

前端 未结 4 437
悲&欢浪女
悲&欢浪女 2021-01-27 21:45

When I access a bean from spring bean configuration file using BeanFactory like this:

public class Person {
    private String id,address;
    @Autowired
    pri         


        
4条回答
  •  长发绾君心
    2021-01-27 22:37

    You have to use AnnotationConfigApplicationContext or you have to add to yor Spring.xml to activate the annotation scan.

提交回复
热议问题