简体   繁体   English

Thymeleaf-基于配置文件的Spring Boot MVC资源位置

[英]Thymeleaf - Spring Boot MVC resource location based on profile

How can I load static js and css on development profile, but from https://cdnjs.cloudflare.com on production profile? 如何从开发配置文件上的https://cdnjs.cloudflare.com上的开发配置文件中加载静态js和CSS? Using Spring Boot - MVC and Thymeleaf. 使用Spring Boot-MVC和Thymeleaf。

I think you have to configure or provide your own ResourceHandlerRegistry . 我认为您必须配置或提供自己的ResourceHandlerRegistry Then you can define where spring-boot looks for static resources. 然后,您可以定义spring-boot在哪里寻找静态资源。

You can look here 你可以看这里

You can use properties based on your active profiles so that you can load resources in different stages from different locations 您可以使用基于活动配置文件的属性,以便可以从不同位置加载不同阶段的资源

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

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