|
|
|
@ -4256,12 +4256,18 @@ Note that, when using both `EncodedResourceResolver` (for example, Gzip, Brotli |
|
|
|
`VersionedResourceResolver`, they must be registered in that order, to ensure content-based |
|
|
|
`VersionedResourceResolver`, they must be registered in that order, to ensure content-based |
|
|
|
versions are always computed reliably based on the unencoded file. |
|
|
|
versions are always computed reliably based on the unencoded file. |
|
|
|
|
|
|
|
|
|
|
|
https://www.webjars.org/documentation[WebJars] are also supported through the |
|
|
|
For https://www.webjars.org/documentation[WebJars], versioned URLs like |
|
|
|
|
|
|
|
`/webjars/jquery/1.2.0/jquery.min.js` are the recommended and most efficient way to use them. |
|
|
|
|
|
|
|
The related resource location is configured out of the box with Spring Boot (or can be configured |
|
|
|
|
|
|
|
manually via `ResourceHandlerRegistry`) and does not require to add the |
|
|
|
|
|
|
|
`org.webjars:webjars-locator-core` dependency. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Version-less URLs like `/webjars/jquery/jquery.min.js` are supported through the |
|
|
|
`WebJarsResourceResolver` which is automatically registered when the |
|
|
|
`WebJarsResourceResolver` which is automatically registered when the |
|
|
|
`org.webjars:webjars-locator-core` library is present on the classpath. The resolver can |
|
|
|
`org.webjars:webjars-locator-core` library is present on the classpath, at the cost of a |
|
|
|
re-write URLs to include the version of the jar and can also match against incoming URLs |
|
|
|
classpath scanning that could slow down application startup. The resolver can re-write URLs to |
|
|
|
without versions -- for example, from `/jquery/jquery.min.js` to |
|
|
|
include the version of the jar and can also match against incoming URLs without versions |
|
|
|
`/jquery/1.2.0/jquery.min.js`. |
|
|
|
-- for example, from `/webjars/jquery/jquery.min.js` to `/webjars/jquery/1.2.0/jquery.min.js`. |
|
|
|
|
|
|
|
|
|
|
|
TIP: The Java configuration based on `ResourceHandlerRegistry` provides further options |
|
|
|
TIP: The Java configuration based on `ResourceHandlerRegistry` provides further options |
|
|
|
for fine-grained control, e.g. last-modified behavior and optimized resource resolution. |
|
|
|
for fine-grained control, e.g. last-modified behavior and optimized resource resolution. |
|
|
|
|