Skip to content

Instantly share code, notes, and snippets.

@SimonHarmonicMinor
Created February 24, 2021 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SimonHarmonicMinor/0e002a02f2911560498d3868d0ba907f to your computer and use it in GitHub Desktop.
Save SimonHarmonicMinor/0e002a02f2911560498d3868d0ba907f to your computer and use it in GitHub Desktop.
public class Person {
public Person() {
System.out.println("I was created");
}
@PostConstruct
private void init() {
System.out.println("I was constructed");
}
}
@Configuration
public class Conf {
@Bean
public Person person() {
return new Person();
}
@Bean
public Book book() {
var oldPerson = person();
System.out.println("oldPerson " + oldPerson);
return new Book();
}
@Bean
public Person person2() {
return person();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment