分类 springboot 中的文章

springboot常见兼容性错误

前言

springboot日常使用中有一些兼容性的错误,有时候没遇见过会让人无法摸到头脑,这里记录一些问题,后续不定期补充

1、mysql

1.1 Received fatal alert: protocol_version

因为更换了数据源才发现并记录,之前用的是mariadb8正常,换了docker mysql8就报错,不过为了减少无法定位的错建议采用完整的url连接串。

1
2
3
4
5
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 6 milliseconds ago.  The last packet sent successfully to the server was 5 milliseconds ago.

Caused by: javax.net.ssl.SSLException: Received fatal alert: protocol_version

原因:
spring.database.url连接串需要增加useSSL=false

……

阅读全文

springboot cli&springcloud cli简单介绍

前言

尝试了下springboot cli和spring cloud cli 命令,整理了下参数和创建项目的介绍

1、下载

1.1 下载springboot cli安装包

官方介绍:https://docs.spring.io/spring-boot/docs/current/reference/html/getting-started.html#getting-started.system-requirements

注意:

需要核对版本支持的jdk、maven、gradle、springboot版本,不能过于追求最新版本,比如springboot3.0.0.M1就只支持jdk17

……

阅读全文

android下的termux模拟器安装openJDK和运行springboot项目

前言

2020年9月份打造好了termux,但是苦于jdk没法安装,只能简单的用ecj(eclipse的java,类似jdk的javac),但是springboot或者tomcat的项目怎么跑啊? 今天为了做培训演示,找到了termux下的openJDK资源,记录下安装的经过。termux的安装和工具准备参考前一篇android下安装termux模拟器-超便携linux

……

阅读全文

springboot的devTools热部署

前言

springboot利用devtools实现热部署

1、application.yml

1
2
3
4
5
6
7
8
9
spring:
    devtools:
        restart:
            #热部署生效
          enabled: true
            #设置重启的目录
            #additional-paths: src/main/java
            #classpath目录下的WEB-INF文件夹内容修改不重启
          exclude: WEB-INF/**

设置WEB-INF下的jsp修改不需要重启。

2、pom.xml

1
2
3
4
5
6
7
8
<!--devtools热部署-->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <optional>true</optional>
    <!-- optional=true,依赖不会传递,该项目依赖devtools;之后依赖该项目的项目如果想要使用devtools,需要重新引入 -->
    <scope>true</scope>
</dependency>
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
      <fork>true</fork>
    </configuration>
    <dependencies>
      <!-- spring热部署-->
      <!-- https://mvnrepository.com/artifact/org.springframework/springloaded -->
      <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>springloaded</artifactId>
        <version>1.2.6.RELEASE</version>
      </dependency>
    </dependencies>
</plugin>

3、idea设置

1、File-Settings-Compiler-Build Project automatically
2、ctrl + shift + alt + /,选择Registry,勾上 Compiler autoMake allow when app running

……

阅读全文

最近文章

分类

标签

其它