Skip to content

Commit 75ea72b

Browse files
committed
Java:Demo 升级 APIJSON 7.0.3 及 JDK17
1 parent 7d6f6c0 commit 75ea72b

File tree

2 files changed

+30
-12
lines changed

2 files changed

+30
-12
lines changed

APIJSON-Java-Server/APIJSONDemo/pom.xml

+26-8
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,36 @@
55

66
<groupId>apijson.demo</groupId>
77
<artifactId>apijson-demo</artifactId>
8-
<version>6.2.0</version>
8+
<version>7.0.3</version>
99

1010
<name>APIJSONDemo</name>
1111
<description>Demo project for Testing APIJSON Server based on SpringBoot</description>
1212

1313
<properties>
1414
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1515
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
16-
<java.version>1.8</java.version>
16+
<java.version>17</java.version>
17+
<maven.compiler.source>17</maven.compiler.source>
18+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
19+
<maven.compiler.target>17</maven.compiler.target>
1720
</properties>
1821

1922
<dependencies>
2023
<!-- 需要的 APIJSON 相关依赖 -->
2124
<dependency>
2225
<groupId>com.github.Tencent</groupId>
2326
<artifactId>APIJSON</artifactId>
24-
<version>6.2.0</version>
27+
<version>7.0.3</version>
2528
</dependency>
2629
<dependency>
2730
<groupId>com.github.APIJSON</groupId>
2831
<artifactId>apijson-framework</artifactId>
29-
<version>6.2.0</version>
32+
<version>7.0.3</version>
33+
</dependency>
34+
<dependency>
35+
<groupId>jakarta.servlet</groupId>
36+
<artifactId>jakarta.servlet-api</artifactId>
37+
<version>6.0.0</version>
3038
</dependency>
3139

3240
<!-- 需要用的数据库 JDBC 驱动 -->
@@ -46,7 +54,17 @@
4654
<dependency>
4755
<groupId>org.springframework.boot</groupId>
4856
<artifactId>spring-boot-starter-web</artifactId>
49-
<version>2.5.13</version>
57+
<version>3.2.5</version>
58+
<exclusions>
59+
<exclusion>
60+
<groupId>ch.qos.logback</groupId>
61+
<artifactId>logback-classic</artifactId>
62+
</exclusion>
63+
<!-- <exclusion>-->
64+
<!-- <groupId>org.slf4j</groupId>-->
65+
<!-- <artifactId>slf4j-simple</artifactId>-->
66+
<!-- </exclusion>-->
67+
</exclusions>
5068
</dependency>
5169

5270
</dependencies>
@@ -56,7 +74,7 @@
5674
<plugin>
5775
<groupId>org.springframework.boot</groupId>
5876
<artifactId>spring-boot-maven-plugin</artifactId>
59-
<version>2.5.13</version>
77+
<version>3.2.5</version>
6078
<executions>
6179
<execution>
6280
<goals>
@@ -70,8 +88,8 @@
7088
<artifactId>maven-compiler-plugin</artifactId>
7189
<version>3.8.1</version>
7290
<configuration>
73-
<source>1.8</source>
74-
<target>1.8</target>
91+
<source>17</source>
92+
<target>17</target>
7593
</configuration>
7694
</plugin>
7795
</plugins>

APIJSON-Java-Server/APIJSONDemo/src/main/java/apijson/demo/DemoController.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import java.net.URLDecoder;
1818
import java.util.Map;
1919

20-
import javax.servlet.http.HttpSession;
20+
import jakarta.servlet.http.HttpSession;
2121

2222
import org.springframework.web.bind.annotation.GetMapping;
2323
import org.springframework.web.bind.annotation.PathVariable;
@@ -61,7 +61,7 @@ public Parser<Long> newParser(HttpSession session, RequestMethod method) {
6161
*/
6262
@PostMapping(value = "{method}") // 如果和其它的接口 URL 冲突,可以加前缀,例如改为 crud/{method} 或 Controller 注解 @RequestMapping("crud")
6363
@Override
64-
public String crud(@PathVariable String method, @RequestBody String request, HttpSession session) {
64+
public String crud(@PathVariable("method") String method, @RequestBody String request, HttpSession session) {
6565
return super.crud(method, request, session);
6666
}
6767

@@ -87,7 +87,7 @@ public String crudAll(@RequestBody String request, HttpSession session) {
8787
*/
8888
@PostMapping("{method}/{tag}") // 如果和其它的接口 URL 冲突,可以加前缀,例如改为 crud/{method}/{tag} 或 Controller 注解 @RequestMapping("crud")
8989
@Override
90-
public String crudByTag(@PathVariable String method, @PathVariable String tag, @RequestParam Map<String, String> params, @RequestBody String request, HttpSession session) {
90+
public String crudByTag(@PathVariable("method") String method, @PathVariable("tag") String tag, @RequestParam Map<String, String> params, @RequestBody String request, HttpSession session) {
9191
return super.crudByTag(method, tag, params, request, session);
9292
}
9393

@@ -99,7 +99,7 @@ public String crudByTag(@PathVariable String method, @PathVariable String tag, @
9999
* @see {@link RequestMethod#GET}
100100
*/
101101
@GetMapping("get/{request}")
102-
public String openGet(@PathVariable String request, HttpSession session) {
102+
public String openGet(@PathVariable("request") String request, HttpSession session) {
103103
try {
104104
request = URLDecoder.decode(request, StringUtil.UTF_8);
105105
} catch (Exception e) {

0 commit comments

Comments
 (0)