Skip to content

Commit 9ed61dc

Browse files
committed
feat(project): upgrade to springboot3
1 parent ae20c0a commit 9ed61dc

27 files changed

+321
-174
lines changed

.github/workflows/ci.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: CI
2+
3+
on:
4+
release:
5+
types: [ published ]
6+
7+
jobs:
8+
test:
9+
name: Run tests
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Set up JDK 17
14+
uses: actions/setup-java@v2
15+
with:
16+
java-version: '17'
17+
distribution: 'temurin'
18+
cache: maven
19+
- name: Build Image with Maven
20+
run: |
21+
mvn -B test
22+
- name: Caching Maven Dependencies
23+
uses: actions/cache@v2
24+
with:
25+
path: ~/.m2/repository
26+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
27+
restore-keys: |
28+
${{ runner.os }}-maven-
29+
push-image:
30+
name: Push Docker image
31+
needs: [ test ]
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v2
35+
- name: Set up JDK 17
36+
uses: actions/setup-java@v2
37+
with:
38+
java-version: '17'
39+
distribution: 'temurin'
40+
cache: maven
41+
- name: Build Image with Maven
42+
run: |
43+
cd limon-ui && mvn -B install
44+
cd ../limon-server
45+
mvn -B -Dmaven.test.skip=true spring-boot:build-image -Ddocker.image-name=aircjm/limon:latest -Ddocker.username=${{ secrets.DOCKER_USERNAME }} -Ddocker.password=${{ secrets.DOCKER_PASSWORD }}
46+
- name: Caching Maven Dependencies
47+
uses: actions/cache@v2
48+
with:
49+
path: ~/.m2/repository
50+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
51+
restore-keys: |
52+
${{ runner.os }}-maven-
53+
push-native-image:
54+
name: Push Docker native image
55+
needs: [ test ]
56+
runs-on: ubuntu-latest
57+
steps:
58+
- uses: actions/checkout@v2
59+
- name: Set up JDK 17
60+
uses: actions/setup-java@v2
61+
with:
62+
java-version: '17'
63+
distribution: 'temurin'
64+
cache: maven
65+
- name: Build Image with Maven
66+
run: |
67+
cd limon-ui && mvn -B install
68+
cd ../limon-server
69+
mvn -B -Dmaven.test.skip=true -Pnative spring-boot:build-image -Ddocker.image-name=aircjm/limon-native:latest -Ddocker.username=${{ secrets.DOCKER_USERNAME }} -Ddocker.password=${{ secrets.DOCKER_PASSWORD }}
70+
deploy:
71+
name: Deploy to remote server
72+
needs: [ test, push-image ]
73+
runs-on: ubuntu-latest
74+
steps:
75+
- name: Deploy Docker Image
76+
uses: appleboy/ssh-action@master
77+
with:
78+
host: ${{ secrets.HOST }}
79+
username: ${{ secrets.SSH_USER }}
80+
key: ${{ secrets.SSH_KEY }}
81+
command_timeout: 10m
82+
script: |
83+
docker pull aircjm/limon:latest
84+
docker rm -f limon || true
85+
docker run -p 8082:6088 -e JAVA_OPTS="-Dfile.encoding=UTF-8 -Duser.timezone=GMT+8 -Dspring.jpa.hibernate.ddl-auto=create -Dspring.datasource.url=${{ secrets.DS_JDBC_URL }} -Dspring.datasource.username=${{ secrets.DS_USERNAME }} -Dspring.datasource.password=${{ secrets.DS_PASSWORD }}" -d --name limon aircjm/limon:latest
86+
87+
88+

.github/workflows/maven-test.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3+
4+
name: Maven Test
5+
6+
on:
7+
pull_request:
8+
branches: [ main ]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up JDK 17
16+
uses: actions/setup-java@v2
17+
with:
18+
java-version: '17'
19+
distribution: 'temurin'
20+
cache: maven
21+
- name: Build Image Test with Maven
22+
run: |
23+
mvn -B test
24+
- name: Caching Maven Dependencies
25+
uses: actions/cache@v2
26+
with:
27+
path: ~/.m2/repository
28+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
29+
restore-keys: |
30+
${{ runner.os }}-maven-

.github/workflows/schedule.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Deploy to remote server
2+
3+
on:
4+
schedule:
5+
- cron: 0 */6 * * *
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Deploy Docker Image
12+
uses: appleboy/ssh-action@master
13+
with:
14+
host: ${{ secrets.HOST }}
15+
username: ${{ secrets.SSH_USER }}
16+
key: ${{ secrets.SSH_KEY }}
17+
command_timeout: 10m
18+
script: |
19+
docker pull cjbi/admin3:latest
20+
docker rm -f admin3 || true
21+
docker run -p 8082:6088 -e JAVA_OPTS="-Dfile.encoding=UTF-8 -Duser.timezone=GMT+8 -Dspring.jpa.hibernate.ddl-auto=create -Dspring.datasource.url=${{ secrets.DS_JDBC_URL }} -Dspring.datasource.username=${{ secrets.DS_USERNAME }} -Dspring.datasource.password=${{ secrets.DS_PASSWORD }}" -d --name admin3 cjbi/admin3:latest

limon-server/pom.xml

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.springframework.boot</groupId>
77
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>2.7.6</version>
8+
<version>3.0.4</version>
99
<relativePath/> <!-- lookup parent from repository -->
1010
</parent>
1111
<groupId>com.aircjm</groupId>
@@ -14,26 +14,30 @@
1414
<name>limon-server</name>
1515
<description>limon-server</description>
1616
<properties>
17-
<java.version>1.8</java.version>
17+
<java.version>17</java.version>
18+
<docker.image-name/>
19+
<docker.username/>
20+
<docker.password/>
1821
</properties>
1922
<dependencies>
2023
<dependency>
2124
<groupId>org.springframework.boot</groupId>
22-
<artifactId>spring-boot-starter-validation</artifactId>
25+
<artifactId>spring-boot-starter-web</artifactId>
2326
</dependency>
27+
2428
<dependency>
2529
<groupId>org.springframework.boot</groupId>
26-
<artifactId>spring-boot-starter-web</artifactId>
30+
<artifactId>spring-boot-starter-validation</artifactId>
2731
</dependency>
2832
<dependency>
2933
<groupId>com.baomidou</groupId>
3034
<artifactId>mybatis-plus-boot-starter</artifactId>
31-
<version>3.5.1</version>
35+
<version>3.5.3.1</version>
3236
</dependency>
3337
<dependency>
3438
<groupId>com.github.xiaoymin</groupId>
35-
<artifactId>knife4j-openapi2-spring-boot-starter</artifactId>
36-
<version>4.0.0</version>
39+
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
40+
<version>4.1.0</version>
3741
</dependency>
3842
<dependency>
3943
<groupId>cn.hutool</groupId>
@@ -71,16 +75,32 @@
7175

7276
<build>
7377
<plugins>
78+
<plugin>
79+
<groupId>org.graalvm.buildtools</groupId>
80+
<artifactId>native-maven-plugin</artifactId>
81+
</plugin>
7482
<plugin>
7583
<groupId>org.springframework.boot</groupId>
7684
<artifactId>spring-boot-maven-plugin</artifactId>
7785
<configuration>
78-
<excludes>
79-
<exclude>
80-
<groupId>org.projectlombok</groupId>
81-
<artifactId>lombok</artifactId>
82-
</exclude>
83-
</excludes>
86+
<image>
87+
<name>${docker.image-name}</name>
88+
<publish>true</publish>
89+
</image>
90+
<docker>
91+
<publishRegistry>
92+
<username>${docker.username}</username>
93+
<password>${docker.password}</password>
94+
<url>https://index.docker.io/v2</url>
95+
</publishRegistry>
96+
</docker>
97+
</configuration>
98+
</plugin>
99+
<plugin>
100+
<groupId>org.apache.maven.plugins</groupId>
101+
<artifactId>maven-surefire-plugin</artifactId>
102+
<configuration>
103+
<argLine>-Dfile.encoding=UTF-8</argLine>
84104
</configuration>
85105
</plugin>
86106
</plugins>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.aircjm.limon.project.anki.response;
22

33

4-
import io.swagger.annotations.ApiModelProperty;
4+
import io.swagger.v3.oas.annotations.media.Schema;
55
import lombok.Data;
66

77
/**
@@ -10,10 +10,10 @@
1010
@Data
1111
public class AnkiRespVo {
1212

13-
@ApiModelProperty(value = "anki返回结果")
13+
@Schema(name = "anki返回结果")
1414
private String result;
1515

16-
@ApiModelProperty(value = "错误信息")
16+
@Schema(name = "错误信息")
1717
private String error;
1818

1919
}

limon-server/src/main/java/com/aircjm/limon/project/card/config/TrelloBean.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import org.springframework.context.annotation.Bean;
1010
import org.springframework.context.annotation.Configuration;
1111

12-
import javax.annotation.Resource;
1312
import java.util.Map;
1413

1514
/**
Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,45 @@
11
package com.aircjm.limon.project.card.constants;
22

33
import com.baomidou.mybatisplus.annotation.EnumValue;
4-
import com.baomidou.mybatisplus.annotation.IEnum;
54
import lombok.AllArgsConstructor;
6-
import lombok.Getter;
75
import lombok.NoArgsConstructor;
8-
import lombok.Setter;
96

107
/**
118
* 枚举-任务状态
9+
*
1210
* @author chenjiaming
1311
*/
1412

1513
@NoArgsConstructor
1614
@AllArgsConstructor
17-
public enum TaskStatusEnum implements IEnum<Integer> {
15+
public enum TaskStatusEnum {
1816

1917
TODO(0, "待处理"),
2018
DOING(1, "处理中"),
2119
DONE(9, "已完成"),
2220
DEL(-1, "已删除");
2321

2422

25-
@Setter
26-
@Getter
2723
@EnumValue
2824
private int value;
2925

3026

31-
@Setter
32-
@Getter
3327
private String desc;
3428

35-
@Override
36-
public Integer getValue() {
37-
return this.value;
29+
30+
public int getValue() {
31+
return value;
32+
}
33+
34+
public void setValue(int value) {
35+
this.value = value;
36+
}
37+
38+
public String getDesc() {
39+
return desc;
40+
}
41+
42+
public void setDesc(String desc) {
43+
this.desc = desc;
3844
}
3945
}

limon-server/src/main/java/com/aircjm/limon/project/card/controller/CardController.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
import com.aircjm.limon.project.card.vo.response.TaskDetailResponse;
88
import com.aircjm.limon.system.vo.Result;
99
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
10-
import io.swagger.annotations.Api;
10+
import io.swagger.v3.oas.annotations.tags.Tag;
11+
import jakarta.annotation.Resource;
12+
import jakarta.validation.Valid;
1113
import org.springframework.web.bind.annotation.*;
1214

13-
import javax.annotation.Resource;
14-
import javax.validation.Valid;
1515

1616
/**
1717
* trello对外卡片card提供接口
@@ -20,7 +20,7 @@
2020
*/
2121
@RestController
2222
@RequestMapping(value = "/api/card/")
23-
@Api(value = "CardController", description = "卡片实体API")
23+
@Tag(name = "CardController", description = "卡片实体API")
2424
public class CardController {
2525

2626

limon-server/src/main/java/com/aircjm/limon/project/card/controller/TaskController.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
import com.aircjm.limon.project.card.vo.response.TaskDetailResponse;
99
import com.aircjm.limon.system.vo.Result;
1010
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
11-
import io.swagger.annotations.Api;
11+
import io.swagger.v3.oas.annotations.tags.Tag;
12+
import jakarta.annotation.Resource;
13+
import jakarta.validation.Valid;
1214
import org.springframework.web.bind.annotation.*;
1315
import org.springframework.web.multipart.MultipartFile;
1416

15-
import javax.annotation.Resource;
16-
import javax.validation.Valid;
1717
import java.util.List;
1818

1919
/**
@@ -24,7 +24,7 @@
2424
*/
2525
@RestController
2626
@RequestMapping(value = "/api/task/")
27-
@Api(value = "记录API")
27+
@Tag(name = "记录API")
2828
public class TaskController {
2929

3030

0 commit comments

Comments
 (0)