-
Notifications
You must be signed in to change notification settings - Fork 40.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Publication of DataSourceSchemaCreatedEvent is more prone to creating a cycle than it was in 2.0 #14651
Comments
There's a cycle: Irrespective of what, if anything, we can do about this in Boot, I think a change in Spring Cloud Task so that |
There's a broader problem here that affects earlier version of Spring Cloud Task. With Spring Cloud Task 1.2.3, the JPA sample will fail if there's a |
The problem can be avoided with a more focussed application listener that also makes that type information available via its bean definition: private final class ApplicationReadyEventListener
implements ApplicationListener<ApplicationReadyEvent> {
@Override
public void onApplicationEvent(ApplicationReadyEvent event) {
}
}
@Bean
public ApplicationReadyEventListener jpaUsingApplicationListener(
EntityManagerFactory emf) {
return new ApplicationReadyEventListener();
} In this case the |
Here's a possible change that makes Boot more tolerant of an Given that Spring Cloud Task really needs to be changed in this area anyway, I don't think we have to do something here. We need to decide if we want to do something anyway. If we do, it will make things more robust for other application listeners that can trigger unwanted early initialisation. |
Spring Boot 2.1.M3
Issue
We found a
BeanCreationException
using Spring Boot 2.1 while creating a Spring Cloud Task application that uses JPA. In our example a user has marked a method (which executes aJPARepository.save
) with the@BeforeTask
annotation that allows Spring Cloud Task to call this method prior toApplicationRunner
. Specifically theBeanCreationException
occurs when Spring Cloud TaskTaskLifecycleListener
(ApplicationLifecycleListener
impl) tries to resolve theComponent
that contains theJPARepository
Autowire.Discussion
Had a discussion with Andy Wilkinson and he validated the case.
To Reproduce
mvn clean install
. The JPA sample test will fail. <Build time about 2 min 10 sec>The text was updated successfully, but these errors were encountered: