mybatis报错error buliding sqlsession

idea使用mybatis时报错error building sqlsession该如何更改,求各位帮帮忙

img

img

配置文件有问题,配置文件发出来瞅瞅

读取不到你的UserMapper.xml,看下你的配置文件是怎么配置的

  • 这篇文章讲的很详细,请看:mybatis 工具类报sqlsessionfactory空指针
  • 除此之外, 这篇博客: Mybatis-Plus与Mybatis的sqlSessionFactory自定义中的 Mybatis-Plus 部分也许能够解决你的问题, 你可以仔细阅读以下内容或跳转源博客中阅读:
  • Mybatis-Plus其实也可以不写mapper.xml的配置文件,所有自定义时不一定需要去扫描*.mapper.xml配置文件

    	@Bean
    	public SqlSessionFactory sqlSessionFactory(DataSourceProxy dataSourceProxy) throws Exception {
    		SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
    		sqlSessionFactoryBean.setDataSource(dataSourceProxy);
    		sqlSessionFactoryBean.setTypeAliasesPackage("com.bitter.storage.domain");
    
    		MybatisConfiguration configuration = new MybatisConfiguration();
    		configuration.setDefaultScriptingLanguage(MybatisXMLLanguageDriver.class);
    		configuration.setJdbcTypeForNull(JdbcType.NULL);
    		sqlSessionFactoryBean.setConfiguration(configuration);
    
    		sqlSessionFactoryBean.setTransactionFactory(new SpringManagedTransactionFactory());
    		return sqlSessionFactoryBean.getObject();
    	}