2022年1月6日
摘要: 主要原理 public Locale resolveLocale(HttpServletRequest request) { Locale defaultLocale = this.getDefaultLocale(); if (defaultLocale != null && request.ge 阅读全文
posted @ 2022-01-06 22:46 upupup-999 阅读(107) 评论(0) 推荐(0)
摘要: @Configurationpublic class MyMvcConfig implements WebMvcConfigurer { // public interface ViewResolver 实现了视图解析器接口的类,我们就可以把它看做视图解析器 @Bean public ViewRes 阅读全文
posted @ 2022-01-06 21:47 upupup-999 阅读(46) 评论(0) 推荐(0)
摘要: 原理 public static final String DEFAULT_PREFIX = "classpath:/templates/"; public static final String DEFAULT_SUFFIX = ".html"; controller层会在classpath:/t 阅读全文
posted @ 2022-01-06 19:59 upupup-999 阅读(46) 评论(0) 推荐(0)
摘要: 1.分析静态资源添加位置,在WebMvcAutoConfiguration类的addResourceHandlers()方法中 @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { if (!thi 阅读全文
posted @ 2022-01-06 16:19 upupup-999 阅读(59) 评论(0) 推荐(0)
摘要: 自定义访问路径:server.servlet.context-path=/wang 阅读全文
posted @ 2022-01-06 15:43 upupup-999 阅读(32) 评论(0) 推荐(0)
摘要: 1. SpringBoot启动会记载大量的自动配置类//spring.factories里面2. 我们看我们需要的功能有没有在SpringBoot默认写好的自动配置类当中;3. 我们再来看这个自动配置类中到底配置了哪些组件;(只要我们要用的组件存在在其中,我们就不要再手动配置了)4. 给容器中自动配 阅读全文
posted @ 2022-01-06 15:39 upupup-999 阅读(37) 评论(0) 推荐(0)