Home > other >  Spring boot test class do you want to add @ RunWith (SpringJUnit4ClassRunner. Class)?
Spring boot test class do you want to add @ RunWith (SpringJUnit4ClassRunner. Class)?

Time:09-16



Business code would only write four years of development, the distributed high concurrency also can't be a programmer? ->>


Automatically generated in the idea of the test class, there is no @ RunWith (SpringJUnit4ClassRunner. Class)? And running?

There must be in other ides, can appear otherwise puzzling npe;



CodePudding user response:


My side has been add

@ RunWith (SpringRunner class)
@ SpringBootTest
@ ActiveProfiles (" dev ")
Public class BaseTest {

}

CodePudding user response:


Standard test class is @ RunWith, Java is told you what the class by running environment, such as start and create a spring application context, otherwise you need to do this when it starts to write a bunch of environment configuration code, you can remove the @ RunWith in the IDEA are still run because recognition on the IDEA as a JUNIT running environment, is equivalent to a self-knowledge of other RunWith environment configuration, but not in other ides,
So, for the sake of your code can run in other ides inside normal, suggest or add @ RunWith

CodePudding user response:

CodePudding user response:

Excuse me where is this watch
  • Related