Junit test the null pointer error java.lang.NullPointerException

First, it should not add annotations problems, the general test class is unable to get the bean, it will report a null pointer. Need to make this test class to run in the spring test environment, add the following comment:

@RunWith(SpringJUnit4ClassRunner.class)

Guess you like

Origin www.cnblogs.com/yuan-zhou/p/12118573.html