Use AutoWired notes in the test class has been unable to get to Bean, has been reported null pointer when calling for exception, I have tried to use AutoWired in other classes, the discovery can take effect. Question should be is in the Test class, back looking for a long finally found the problem! ! !
Solution:
Add the following comment on the test class:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:applicationContext.xml")