Use @DependsOn
to make Spring initialize other beans before the annotated one. Usually, this behavior is automatic.
@DependsOn("engine")
class Car implements Vehicle {}
@Bean
@DependsOn("fuel")
Engine engine() {
return new Engine();
}
Use @DependsOn
to make Spring initialize other beans before the annotated one. Usually, this behavior is automatic.
@DependsOn("engine")
class Car implements Vehicle {}
@Bean
@DependsOn("fuel")
Engine engine() {
return new Engine();
}