mybatis-plus Invalid bound statement (not found):

1.若是使用了多数据源配置,请检查 DataSourceConfig配置类:

将SqlSessionFactoryBean改为mybatis-plus里面的MybatisSqlSessionFactoryBean

@Bean(name = "testSqlSessionFactory")
	@Primary
	public SqlSessionFactory testSqlSessionFactory(@Qualifier("testDataSource") DataSource dataSource) throws Exception {
		MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
        //SqlSessionFactoryBean bean = new SqlSessionFactoryBean();

		bean.setDataSource(dataSource);
		//对应mybatis.type-aliases-package配置
		bean.setTypeAliasesPackage("com.cainiao.manage.pojo");
		//对应mybatis.mapper-locations配置
		bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/*.xml"));
		//开启驼峰映射
		bean.getObject().getConfiguration().setMapUnderscoreToCamelCase(true);
		return bean.getObject();
	}

2.若还是报错,检查mybaitis-plus 版本,可用2.x的版本试试

        

    com.baomidou
    mybatisplus-spring-boot-starter
    1.0.5



    com.baomidou
    mybatis-plus
    2.1.8


    org.mybatis.spring.boot
    mybatis-spring-boot-starter
    1.3.2



    org.apache.velocity
    velocity
    1.7
 

 

你可能感兴趣的:(java)