我有两个模块:BE 和 FE(意味着后端和前端)。FE 模块使用 gulp 构建并将结果放入target
文件夹中。BE 模块是在 spring boot 上编写的。有什么办法可以将target
文件夹FE的模块中的资源导入BE模块并打包到spring boot jar中使其成为独立的jar吗?
默认情况下,Spring Boot 提供类路径中名为以下目录的静态内容:
默认情况下,资源映射到 /**,但您可以使用 spring.mvc.static-path-pattern 属性对其进行调整
webjar 的特殊情况。任何在 /webjars/** 中有路径的资源都是从 jar 文件提供的。
文档静态内容中的更多信息
因此,您需要更改存储 FE 文件的位置。或者您可以自定义您的 MVC 配置:
@Configuration
@EnableWebMvc
public class WebConfig implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**")
.addResourceLocations("/mycustompath", "classpath:/anotherone/")
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句