在看一个博客源码发现页面的图片所映射的地址在SpringBoot静态资源文件夹下找不到原來在这里是通过下面这段代码,将/store/**
地址映射为getStorePath()得到的地址,在此记录以下
registry.addResourceHandler("/store/**").addResourceLocations(getStorePath());
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/dist/**").addResourceLocations("classpath:/static/dist/");
registry.addResourceHandler("/theme/**").addResourceLocations("classpath:/static/theme/");
registry.addResourceHandler("/store/**").addResourceLocations(getStorePath());
super.addResourceHandlers(registry);
}