Article From:

The project management tool is maven, which has just started learning spring and mybatis. In the process of integrating spring and mybatis, I encountered a problem. Why can’t I not add annotations to a test class @ContextConfigurat?Ion?

Answer 0:

If you use SpringJUnit4ClassRunner to start the Spring container, the container will manage your object before you can use automatic injection. The problem with NPE is that the container is not started.


Leave a Reply

Your email address will not be published. Required fields are marked *