[Solved] Mybatis Error: Resources.getResourceAsStream(resource) cannot find the method

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: