zou-rong

application.yaml

server:
servlet:
#拦截路径
context-path: /
#端口
port: 8088
logging:
level:
#日志级别,目录: 级别
com.company: debug

org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration.java中有

@Configuration(proxyBeanMethods = false)
@Import(EnableWebMvcConfiguration.class)
@EnableConfigurationProperties({ WebMvcProperties.class, ResourceProperties.class })
@Order(0)
public static class WebMvcAutoConfigurationAdapter implements WebMvcConfigurer {

点进去ResourceProperties.class

@ConfigurationProperties(prefix = "spring.resources", ignoreUnknownFields = false)
public class ResourceProperties {

private static final String[] CLASSPATH_RESOURCE_LOCATIONS = { "classpath:/META-INF/resources/",
"classpath:/resources/", "classpath:/static/", "classpath:/public/" };

/**
* Locations of static resources. Defaults to classpath:[/META-INF/resources/,
* /resources/, /static/, /public/].
*/
private String[] staticLocations = CLASSPATH_RESOURCE_LOCATIONS;

一般使用"classpath:/static/",前后端分离的项目用不到该配置

分类:

技术点:

相关文章:

  • 2021-11-20
  • 2021-11-20
  • 2021-11-15
  • 2021-08-01
  • 2021-12-24
  • 2021-12-02
猜你喜欢
  • 2021-09-26
  • 2022-12-23
  • 2021-11-20
  • 2021-12-10
  • 2021-11-20
  • 2021-11-20
  • 2021-11-20
相关资源
相似解决方案