zoukankan      html  css  js  c++  java
  • mybatis-plus Invalid bound statement (not found) 问题

    自己搭一个项目,spring boot+mybatis-plus,引用mybatis-plus  执行发现自己写的sql可以执行,执行basemapper里的方法就会出错,

    mybatis-plus Invalid bound statement (not found) 

    检查文件(application.yml、mapper.xml等)配置,编译加载是否正确

    发现都没什么问题,包加载也替换了几个版本,还是不行,

    后面发现需要将mybatis的sqlSessionFactory替换成mybatis-plusd的MybatisSqlSessionFactoryBean

    因为是自己写的sqlSessionFactory加载一直也没注意到这个问题,使用默认配置应该也没有这个问题,记录下

      @Bean("sqlSessionFactory")
    @Primary
    public SqlSessionFactory sqlSessionFactory(@Autowired @Qualifier("dataSource") DataSource dataSource) throws Exception {

    MybatisSqlSessionFactoryBean sqlSessionFactoryBean = new MybatisSqlSessionFactoryBean();
    sqlSessionFactoryBean.setDataSource(dataSource);
    sqlSessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/*.xml"));

    // Interceptor interceptor = new PageInterceptor();
    // Properties properties = new Properties();
    // properties.setProperty("helperDialect", "sqlserver");
    // properties.setProperty("offsetAsPageNum", "true");
    // properties.setProperty("rowBoundsWithCount", "true");
    // properties.setProperty("reasonable", "false");
    // interceptor.setProperties(properties);
    // sqlSessionFactoryBean.setPlugins(new Interceptor[] {interceptor});


    return sqlSessionFactoryBean.getObject();

    }
  • 相关阅读:
    晃动提示效果
    弹出框(dialog)制作
    日期选择组件
    背景图合并
    css小常识
    学习总结
    新学习的开始
    河马搞笑GIF动态图网站(http://gif.hemaj.com)上线,老司机快上车!
    新项目上线,河马体育(http://www.hemaj.com)-足球即时比分、足球比分、足球比分直播、足球直播
    正规表达
  • 原文地址:https://www.cnblogs.com/zhouyb/p/10469973.html
Copyright © 2011-2022 走看看