Question details
When reading the configuration file, when I typed InputStream in = Resources.getResourceAsStream("SqlMapConfig.xml");
it, I found that the getResourceAsStream() method was marked in red, and IDEA said there was no such method.
This article provides a real solution, let you find this method
problem solved
Foreword
After a visit to my csdn, many blogs said it was changed to nputStream inputStream = Resources.class.getResourceAsStream(resource);
I changed it and found that it works, but it feels weird.
Then when
I ran it, I found this error was reported, so I checked the corresponding solution again. When solving this problem, I stumbled upon a solution to the getResourcesAsStream() method.
Solution:
First of all, make sure that the JDK version of file-Project structure-Project is set to the one that you use. I here is 9
and the module here is also changed to 9, keeping the same
** After doing this, you can find the getResourceAsStream() method. . **This solution does not use Resources.class,
but I can’t explain the reason, so let’s use it first (it may be caused by the previous module jdk version 5. It’s too low and there is no such method)
################### If you still
can try this set
it down on it firmly