Why is mongoTemplate always null?
springmvc mongo intellij idea macos
The error message is java.lang.NullPointerException
Hello, great gods
I’m building an APP backstage with itellij idea on MacOS. Now I need to integrate mongo. I’m having a problem. Is mongoTemplate always null every time a request is made to access the background interface?
Some kind-hearted people please help me and beg on my knees. I have just written backstage for a week. My QQ1746483621.
I have found a solution to my problem. I’d like to talk about it here.
May be your code logic problems, caused by the Ioc container
Therefore, you can try to manually get the Bean in Ioc and use the ApplicationContext class.
You can refer to:https://www.jianshu.com/p/fa5 …