当前使用版本(必填,否则不予处理)
3.4.0
该问题是如何引起的?(确定最新版也有问题再提!!!)
在项目整合flowable时 flowable自己的 starter也提供了 sqlSessionFactory
重现步骤(如果有就写完整)
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter</artifactId>
<version>6.6.0</version>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter-ui-modeler</artifactId>
<version>6.6.0</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.0</version>
</dependency>
报错信息
于是自己注册解决
@Bean
@Primary
public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception {
MybatisSqlSessionFactoryBean factory = new MybatisSqlSessionFactoryBean();
factory.setDataSource(dataSource);
factory.setVfs(SpringBootVFS.class);
return factory.getObject();
}
@Bean
@Primary
public SqlSessionTemplate sqlSessionTemplate(SqlSessionFactory sqlSessionFactory) {
return new SqlSessionTemplate(sqlSessionFactory);
}
建议
看了下 org/flowable/ui/modeler/conf/ModelerDatabaseConfiguration.class 代码
他们使用了注解 @Qualifier("flowableModeler") 来对注册的bean分类 建议 mybatis-plus-boot-starter 也可以这样写配置类
Comment From: miemieYaho
如果这个类被执行,那他始终会注入 sqlsessionfactory,那我们提供的starter就始终不会执行