-
Notifications
You must be signed in to change notification settings - Fork 41.4k
Description
After upgrading application to Spring 2.1.0 I tried to use Hibernate asynchronously bootstrap, but when I'm adding a flag spring.data.jpa.repositories.bootstrap-mode=deferred
to configuration then application throws error during startup:
Parameter 0 of method entityManagerFactory in org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration required a single bean, but 2 were found: - [ ] - applicationTaskExecutor: defined by method 'applicationTaskExecutor' in class path resource [org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.class] - taskScheduler: defined by method 'taskScheduler' in class path resource [org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.class]
Looks like Spring have trouble with finding unique AsyncTaskExecutor
bean and both beans are coming from auto configuration. To make it work I excluded TaskExecutionAutoConfiguration
:
@SpringBootApplication(exclude = {TaskExecutionAutoConfiguration.class})
@EnableScheduling
class MyApp {}