How does Spring prevent a second call to bar() when using Java based configurations?
I\'m wondering compile time annotation processing or by proxying the method?
Spring does not "prevent" a call to bar(). Instead, at startup, spring generates a list of @Bean marked methods then calls each method one time. If you want, you can call bar() a hundred times. Spring, however; will only call it one time.
bar()
@Bean