简体   繁体   English

是否可以在 Spring Boot 中注入其他项目的 static 资源?

[英]Is it possible to inject static resources from other projects in Spring Boot?

By example, have a WEB project, but need add a custom static content from vendors without recompile the main jar project.例如,有一个 WEB 项目,但需要添加来自供应商的自定义 static 内容,而无需重新编译主 jar 项目。

Is it possible to run the Spring Boot.jar file and give some argument to tell it to load other jars where different static contents are found or from code dynamically? Is it possible to run the Spring Boot.jar file and give some argument to tell it to load other jars where different static contents are found or from code dynamically? For example:例如:

  • 1.jar : src/resources/static/vendor1/ 1.jarsrc/resources/static/vendor1/
  • 2.jar : src/resources/static/vendor2/ 2.jarsrc/resources/static/vendor2/

Etc.等等。

You need to specify a property named loader.path .您需要指定一个名为loader.path的属性。 Quote from Docs来自Docs的报价

Comma-separated Classpath, such as lib,${HOME}/app/lib.逗号分隔的 Classpath,例如 lib,${HOME}/app/lib。 Earlier entries take precedence, like a regular -classpath on the javac command line.较早的条目优先,例如 javac 命令行上的常规 -classpath。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM