解决方案 加上TestPropertySource注解,然后将之前@value映射的路径,写在properties中就可以了 参考 Populating Spring @Value during Unit Test
评论区