Problem Description: mybatisdemo.java
when loading the core configuration file of mybatis and obtaining SqlSessionFactory, the getResourceAsStream() method is marked in red, and the idea indicates that there is no such method.
1, Load the core configuration file of mybatis and get the SqlSessionFactory
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
Error:Cannot resolve method ‘getResourceAsStream‘ in ‘Resources‘
Solution: import import.org.apache.ibatis.io.Resources
~~
If the error is still reported, it will display: org.apache.ibatis.io does not exist, check the setting information of Maven.
1. First, open the installation root directory of Maven and find settings.xml
Set up the storage repository in settings.xml:
<localRepository>E:\maven\apache-maven-3.6.1\mvn_repo</localRepository>
2. Enter the IDE and make settings
File-Settings-Build,Execution,Depolyment-BuildTools-Maven
take the following configuration as an example:
At this time, the problem was solved!
Read More:
- [Solved] Mybatis uses the PageHelper paging plugin error: Could not find method on interface ibatis.executor.Executor named query.
- SpringBoot uses MyBatis error: Error invoking SqlProvider method (tk.mybatis.mapper.provider.base.BaseInsertProvider.dynamicSQL)
- Mybatis-plus calls its own method error: Invalid bound statement
- [Solved] Communications–8–Generated resource conflict: two resources of the same name: /Radioxx
- mybatis-plus calls its own selectById method and reports an error: org.apache.ibatis.binding.BindingException:
- [Solved] Mybatis crud insert error: org.apache.ibatis.binding.BindingException: Mapper method ‘com.liang.dao.UserMapper.addUser…
- [Solved] Mybatis Error: CannotFindDataSourceException: dynamic-datasource can not find primary datasource
- Springboot package error: failed to execute goal org.apache.maven.plugins:maven-resources-plugin: 3.2.0…
- Find malloc_error_Root cause method of break error
- Spring deployment error: Could not open ServletContext resource [/db.properties]
- MyBatis: Mapped Statements collection does not contain value for xxx
- Mybatis Error: Result Maps collection already contains value
- [Solved] Mybatis Error: Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration.
- [Solved] Mybatis:Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance.
- [Solved] AS Warning: String literal in setText can not be translated. Use Android resources instead.
- Mybatis error under Springboot project: Invalid bound statement (not found)
- [Solved] Mybatis-plus Error: mybatisplus-Invalid bound statement (not found): com.integration.dao.ApiDao.getList
- [Solved] Error creating bean with name ‘sqlSessionFactory‘ defined in class path resource
- Java.lang.AbstractMethodError: org.mybatis.spring.transaction.SpringManagedTransaction.getTimeout()Ljava/lang/Integer; error resolution
- [Solved] K8s cluster build error: error: kubectl get csr No resources found.