1、日志配置
LOG4J 2 CONFIGURATION: USING PROPERTIES FILE
Log4j Conversion Pattern Online Tester
2、Spring Boot Actuator
Spring Boot Actuator in Spring Boot 2.0
3、BeanNotOfRequiredTypeException 异常:but was actually of type 'com.sun.proxy.$Proxy17'
4、Thymleaf
<!-- th:block rather than unneeded div -->
<th:block th:switch="${status.value}">
<div th:case="'COMPLETE'">
<!-- print object is not active -->
</div>
<div th:case="'INVALID'">
<!-- print object is not active -->
</div>
<div th:case="'NEW'">
<!-- print object is new and active -->
</div>
</th:block>
5、Spring Boot: javax.persistence.TransactionRequiredException: Executing an update/delete query
给方法加上@Transactional注解:
@Transactional
void removeTempoAccounts() {
6、Spring Boot打成jar后获取classpath下文件失败
这是因为打包后Spring试图访问文件系统路径,但无法访问JAR中的路径。 因此必须使用resource.getInputStream():
ClassPathResource resource = new ClassPathResource("application.yml");
InputStream inputStream = resource.getInputStream();
IOUtils.readLines(inputStream).forEach(System.out::println);
参考:Java: Load file from classpath in Spring Boot
7、配置
在Spring MVC 应用中如何基于Spring Profile读取不同的配置文件
@PropertySources({
@PropertySource("classpath:config.properties"),
@PropertySource("classpath:db.properties")
})
8、Spring启动时执行指定逻辑
Spring Boot Application Startup Listener or init Method
RUNNING CODE ON SPRING BOOT STARTUP
9、Docker Spring Boot
10、JPA
使用@JsonIgnoreProperties忽略Hibernate无用属性
11、SpringBoot时间相差8小时处理
12、Java 验证IP
13、使用swagger管理Spring boot Rest API
使用swagger管理Spring boot Rest API
14、Spring Boot自定义Starter和Starter原理
15、Spring 资源访问