[Solved] Springboot test class injection bean is null Error: java.lang.NullPointerException…

When the springboot test class injects a NullPointerException object:

Normally, the test class add @springboottest can be tested normally

However, the value of classes in @ springboottest (classes = bootapplication. Class) can inject properties normally only after the class is started. That is, bootapplication is the springboot startup class

@RunWith(SpringRunner.class)

@SpringBootTest(classes = GrouptwoApplication.class)

Similar Posts: