原文链接 莫问博客
1、实用springboot管理项目但是不需要监听web端口的,在yml文件中加如下配置
spring.main.web-application-type=none
2、暂时解决类冲突的方法(不推荐),加如下配置允许bean覆盖
spring.main.allow-bean-definition-overriding=true
3、srpingboot 2.x之后版本在配置文件配置静态文件路径不生效的解决办法,实现WebMvcConfigurer
import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.*; /** * @author xdliu * @Date 2019/10/24 **/ @Configuration public class WebConfig implements WebMvcConfigurer { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/**").addResourceLocations("classpath:/static/"); } }
4、spring框架整合mybatis插入返回主键需要在insert方法中加入useGeneratedKeys="true" keyProperty="id" keyColumn="id" ,当插入操作完成后id会回写映射到插入实体类的id列上,
5、spring boot 中启动时的图形修改
在 src/main/resources目录下新建banner.txt文件,springboot启动时启动图形就会变成banner.txt文件文件中的内容
6、