Spring Boot数据源延迟初始化

时间:2019-02-20 02:19:30

标签: java spring spring-boot hikaricp

@Lazy 注释不适用于数据源配置。该数据源自动连接到原型作用域的Bean中,但是数据源在启动时急于初始化。在堆栈跟踪中,可以看到来自 TomcatServletWebServerFactory 的调用。

struct Module<T> {
    i: T,
}

trait Trait {
    type SomeType;
}

trait Second<T> {
    fn second_function();
}

impl<T: Trait> Module<T> {
    fn first_function() {
        // some code here
    }
}

impl<T: Trait> Second<T::SomeType> for Module<T> {
    fn second_function() {
        Module::<T>::first_function();
    }
}

@Qualifier注释中可能有问题吗?

1 个答案:

答案 0 :(得分:0)

导入spring-boot-starter-jdbc时出现相同的问题。必须更改为仅使用spring-jdbc

相关问题