profile
viewpoint

Ask questionsDynamicDataSourceContextHolder.peek为空

Enviroment

JDK Version(required): 1.8

SpringBoot Version(required): 2.1.5

Starter Version(required):3.1.0

Describe

image

测试的时候

    public static String peek() {
        return (String)((Deque)LOOKUP_KEY_HOLDER.get()).peek();
    }

结果为空

Expected Result:

Actual Result:
没有选择传入数据源,走了默认,这里需要手动push一下吗

Steps to reproduce

  • Step 1
@DS("yc")
    private void testDb(String system){
        List<Entity> list = dao.list(system);
        System.out.println("#########"+list.size());
    }
  • Step 2

  • Step 3

baomidou/dynamic-datasource-spring-boot-starter

Answer questions 0532

嗯 解决了 在程序里没有问题里,可能是测试类配的有问题 @huayanYu 谢谢了 😄

useful!

Related questions

DS注解在Mapper上无效 hot 1
dynamicRoutingDataSource hot 1
dynamicRoutingDataSource hot 1
多数据源启动报错 hot 1
source:https://uonfu.com/
Github User Rank List