我们需要切换junit的main
指定配置类或者配置文件
12345
<dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>4.3.8.RELEASE</version></dependency>
123456
@RunWith(SpringJUnit4ClassRunner.class)@ContextConfiguration(classes = Springconfig.class)public class MainTest { @Autowired private Main m = null;}
@RunWith(SpringJUnit4ClassRunner.class)@ContextConfiguration(locations= "classpath:bean.xml")public class MainTest { @Autowired private Main m = null;}
感谢您的阅读。 🙏 关于转载请看这里