问题描述
@ExtendWith(SpringExtension.class)
@WebMvcTest(MyClass.class)
@TestPropertySource(locations="classpath:application-test.yml")
//是这样的吗?
解决方法
这应该仍然能够在您的应用程序的测试文件中找到属性:
@Autowired
private Environment env;
// Load data
String data = env.getProperty("some.property")