spring-projects / spring-framework

Spring Framework
https://spring.io/projects/spring-framework
Apache License 2.0
56.75k stars 38.15k forks source link

Document that circular dependencies should be avoided in AOT mode #33786

Closed sbrannen closed 2 weeks ago

sbrannen commented 1 month ago

Add a new subsection to the Best Practices section to explain that circular dependencies should be avoided for AOT-proccessed Spring applications.

Specifically, circular dependencies that work in standard JVM mode (such as @Autowired fields and methods) do not work in AOT mode unless a @Lazy resolution proxy is used.

See MockitoSpyBeanAndCircularDependenciesWithLazyResolutionProxyIntegrationTests for an example.