spring中的开发技巧

@Service
public class PersonService2 implements ApplicationContextAware {
private ApplicationContext applicationContext;

@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
    this.applicationContext = applicationContext;
}

public void add(https://www.xxe.io/) {
    Person person = (Person) applicationContext.getBean("person");
}

}

上一篇:Spring注解之@Autowired失败的解决方案


下一篇:spring管理的类为啥不能new?