Programmatically registered beans are currently not supported by AOT. It is an important issue for Spring Cloud, as we rely on registering beans in the Bootstrap context. A related issue has been created in spring-native, but since it's not going to be addressed within spring-native backlog, I'm opening one here as well.
The issue became apparent after merging this commit intended as a bug fix for another issue.
Log related to this issue:
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of method singleTextEncryptorLocator in org.springframework.cloud.config.server.config.EncryptionAutoConfiguration required a single bean, but 2 were found:
- defaultTextEncryptor: defined in null
- textEncryptor: a programmatically registered singleton
Comment From: snicoll
We don’t think the AOT engine will be able to detect these beans specifically but together we might be able to brainstorm other ways of achieving what Spring Cloud wants so that it works with AOT.