架構(gòu)師必備技能docker入門到專精馬老師
@Servicepublic class PersonService3 implements ApplicationListener<ContextRefreshedEvent> {
? ?private ApplicationContext applicationContext;
? ?@Override
? ?public void onApplicationEvent(ContextRefreshedEvent event) {
? ? ? ?applicationContext = event.getApplicationContext();
? ?}
? ?public void add() {
? ? ? ?Person person = (Person) applicationContext.getBean("person");
? ?}}
標簽: