Last active
July 17, 2022 20:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Service | |
class BeanB { | |
@Autowired | |
BeanA beana ; | |
@PostConstruct | |
public void init(){ | |
System.out.println("bean b init is called a.b=" + beana.b); | |
} | |
} | |
@Service | |
@DependsOn("beanB") | |
class BeanA { | |
@Autowired | |
BeanB b; | |
@PostConstruct | |
public void init(){ | |
System.out.println("bean a init is called b.a=" + b.beana); | |
} | |
} | |
output: | |
bean a init is called b.a=null | |
bean b init is called a.b=xxx.BeanB@5c45d770 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Service | |
class BeanB { | |
@Autowired | |
BeanA beana ; | |
@PostConstruct | |
public void init(){ | |
System.out.println("bean b init is called a.b=" + beana.b); | |
} | |
} | |
@Service | |
class BeanA { | |
@Autowired | |
BeanB b; | |
@PostConstruct | |
public void init(){ | |
System.out.println("bean a init is called b.a=" + b.beana); | |
} | |
} | |
output: | |
bean b init is called a.b=null | |
bean a init is called b.a=xxxBeanA@727eb8cb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment