Spring Boot
微服务架构
自动装配
SpringApplication
Yaml语法
@ConfigurationProperties作用
@Component
<!-- 导入配置文件处理器,配置文件进行绑定就会有提示,需要重启 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
Yaml和Properties语法
Yaml
Properties
多环境配置
首页图标
Thymeleaf
自定义视图解析器
package com.wei.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.util.Locale;
@Configuration
public class MyMvcConfig implements WebMvcConfigurer {
//将视图解析器MyViewResolver注入Bean
@Bean
public ViewResolver myViewResolver(){
return new MyViewResolver();
}
//自定义视图解析器MyViewResolver
public static class MyViewResolver implements ViewResolver{
@Override
public View resolveViewName(String viewName, Locale locale) throws Exception {
return null;
}
}
}