springboot +mybatisplus 中如何更换默认的数据源(不是aop的那种线程切换)

@Bean
    public SqlSessionFactory sqlSessionFactory() throws Exception {
     MybatisSqlSessionFactoryBean sqlSessionFactoryBean = new MybatisSqlSessionFactoryBean();
        sqlSessionFactoryBean.setDataSource(dynamicDataSource());
        sqlSessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:com/jksd/mapper/*.xml"));
        sqlSessionFactoryBean.setTypeAliasesPackage("com.jksd.model");
      //导入mybatis配置
        MybatisConfiguration configuration = new MybatisConfiguration();
        configuration.setJdbcTypeForNull(JdbcType.NULL);
        configuration.setMapUnderscoreToCamelCase(true);
        configuration.setCacheEnabled(false);
        sqlSessionFactoryBean.setConfiguration(configuration);
        //PerformanceInterceptor(),OptimisticLockerInterceptor()
        //导入全局配置
        //解决驼峰命名失效
       // sqlSessionFactoryBean.setConfiguration(configuration());
        return sqlSessionFactoryBean.getObject();
    } 
//修改MyBatis的数据源
            MybatisSqlSessionFactoryBean SqlSessionFactory = (MybatisSqlSessionFactoryBean) SpringContextUtils.getBean(MybatisSqlSessionFactoryBean.class);
          Environment environment =SqlSessionFactory.getObject().getConfiguration().getEnvironment();
          Field dataSourceField = environment.getClass().getDeclaredField("dataSource");
          dataSourceField.setAccessible(true);//跳过检查
          dataSourceField.set(environment,datasourceId);//修改mybatis的数据源

报错
org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean' available

有没有大佬用过啊 (想实现的就是 切换数据源后所有 关于数据库的操作都是切换过去的不是 aop那种线程中切换使用)

https://blog.csdn.net/weixin_43240792/article/details/88645099