首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Spring Boot开发问题汇总(不断更新中)

Spring Boot开发问题汇总(不断更新中)

作者头像
九州暮云
发布2019-08-21 11:15:42
6730
发布2019-08-21 11:15:42
举报
文章被收录于专栏:九州牧云九州牧云

1、日志配置

LOG4J 2 CONFIGURATION: USING PROPERTIES FILE

Spring Boot Logging Example

Log4j Conversion Pattern Online Tester

Log4j打印日志到不同的文件

Log4j2 过滤指定级别的日志

Log4j2配置教程

日志文件分割教程

LogBack Appenders

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

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读取不同的配置文件

基于Maven创建指定规范的配置文件

Spring boot加载多个配置文件

@PropertySources({
  @PropertySource("classpath:config.properties"),
  @PropertySource("classpath:db.properties")
 })

8、Spring启动时执行指定逻辑

Spring启动时执行指定逻辑

Spring Boot Application Startup Listener or init Method

RUNNING CODE ON SPRING BOOT STARTUP

9、Docker Spring Boot

Docker化Spring Boot应用

10、JPA

使用@JsonIgnoreProperties忽略Hibernate无用属性

11、SpringBoot时间相差8小时处理

SpringBoot时间相差8小时处理

12、Java 验证IP

Java验证IP

13、使用swagger管理Spring boot Rest API

使用swagger管理Spring boot Rest API

14、Spring Boot自定义Starter和Starter原理

如何创建Spring Boot Starter

自定义Starter官方文档

15、Spring 资源访问

Spring 资源访问剖析和策略模式应用

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
容器镜像服务
容器镜像服务(Tencent Container Registry,TCR)为您提供安全独享、高性能的容器镜像托管分发服务。您可同时在全球多个地域创建独享实例,以实现容器镜像的就近拉取,降低拉取时间,节约带宽成本。TCR 提供细颗粒度的权限管理及访问控制,保障您的数据安全。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档