springboot做单元测试时,启动报错:
明明resource下有该文件,并且通过springboot启动器启动项目时是可以加载的,但使用junit启动则报错。
排查了一下,忽然反应过来,这是一个坑,springboot使用@SpringBootTest时,@SpringBootTest注解,只会加载test路径下的资源文件(即xml配置),并不会加载main路径下的资源文件,
springboot做单元测试时,启动报错:
明明resource下有该文件,并且通过springboot启动器启动项目时是可以加载的,但使用junit启动则报错。
排查了一下,忽然反应过来,这是一个坑,springboot使用@SpringBootTest时,@SpringBootTest注解,只会加载test路径下的资源文件(即xml配置),并不会加载main路径下的资源文件,