GeezerVison is showing github.com — Java:Demo 升级 APIJSON 7.0.3 及 JDK17 · giantank/APIJSON-Demo@75ea72b
File treeExpand file treeCollapse file tree Open diff view settings APIJSON-Java-Server/APIJSONDemo src/main/java/apijson/demo
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: APIJSON-Java-Server/APIJSONDemo/pom.xml +26-8Lines changed: 26 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 5 | 5 |
| 6 | 6 | <groupId>apijson.demo</groupId> | 7 | 7 | <artifactId>apijson-demo</artifactId> | 8 | | - <version>6.2.0</version> | | 8 | + <version>7.0.3</version> | 9 | 9 |
| 10 | 10 | <name>APIJSONDemo</name> | 11 | 11 | <description>Demo project for Testing APIJSON Server based on SpringBoot</description> | 12 | 12 |
| 13 | 13 | <properties> | 14 | 14 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | 15 | 15 | <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> | 17 | 20 | </properties> | 18 | 21 |
| 19 | 22 | <dependencies> | 20 | 23 | <!-- 需要的 APIJSON 相关依赖 --> | 21 | 24 | <dependency> | 22 | 25 | <groupId>com.github.Tencent</groupId> | 23 | 26 | <artifactId>APIJSON</artifactId> | 24 | | - <version>6.2.0</version> | | 27 | + <version>7.0.3</version> | 25 | 28 | </dependency> | 26 | 29 | <dependency> | 27 | 30 | <groupId>com.github.APIJSON</groupId> | 28 | 31 | <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> | 30 | 38 | </dependency> | 31 | 39 |
| 32 | 40 | <!-- 需要用的数据库 JDBC 驱动 --> | | 46 | 54 | <dependency> | 47 | 55 | <groupId>org.springframework.boot</groupId> | 48 | 56 | <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> | 50 | 68 | </dependency> | 51 | 69 |
| 52 | 70 | </dependencies> | | 56 | 74 | <plugin> | 57 | 75 | <groupId>org.springframework.boot</groupId> | 58 | 76 | <artifactId>spring-boot-maven-plugin</artifactId> | 59 | | - <version>2.5.13</version> | | 77 | + <version>3.2.5</version> | 60 | 78 | <executions> | 61 | 79 | <execution> | 62 | 80 | <goals> | | 70 | 88 | <artifactId>maven-compiler-plugin</artifactId> | 71 | 89 | <version>3.8.1</version> | 72 | 90 | <configuration> | 73 | | - <source>1.8</source> | 74 | | - <target>1.8</target> | | 91 | + <source>17</source> | | 92 | + <target>17</target> | 75 | 93 | </configuration> | 76 | 94 | </plugin> | 77 | 95 | </plugins> | |
Collapse file Copy file name to clipboardExpand all lines: APIJSON-Java-Server/APIJSONDemo/src/main/java/apijson/demo/DemoController.java +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 17 | 17 | import java.net.URLDecoder; | 18 | 18 | import java.util.Map; | 19 | 19 |
| 20 | | -import javax.servlet.http.HttpSession; | | 20 | +import jakarta.servlet.http.HttpSession; | 21 | 21 |
| 22 | 22 | import org.springframework.web.bind.annotation.GetMapping; | 23 | 23 | import org.springframework.web.bind.annotation.PathVariable; | @@ -61,7 +61,7 @@ public Parser<Long> newParser(HttpSession session, RequestMethod method) { | 61 | 61 | */ | 62 | 62 | @PostMapping(value = "{method}") // 如果和其它的接口 URL 冲突,可以加前缀,例如改为 crud/{method} 或 Controller 注解 @RequestMapping("crud") | 63 | 63 | @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) { | 65 | 65 | return super.crud(method, request, session); | 66 | 66 | } | 67 | 67 |
| @@ -87,7 +87,7 @@ public String crudAll(@RequestBody String request, HttpSession session) { | 87 | 87 | */ | 88 | 88 | @PostMapping("{method}/{tag}") // 如果和其它的接口 URL 冲突,可以加前缀,例如改为 crud/{method}/{tag} 或 Controller 注解 @RequestMapping("crud") | 89 | 89 | @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) { | 91 | 91 | return super.crudByTag(method, tag, params, request, session); | 92 | 92 | } | 93 | 93 |
| @@ -99,7 +99,7 @@ public String crudByTag(@PathVariable String method, @PathVariable String tag, @ | 99 | 99 | * @see {@link RequestMethod#GET} | 100 | 100 | */ | 101 | 101 | @GetMapping("get/{request}") | 102 | | - public String openGet(@PathVariable String request, HttpSession session) { | | 102 | + public String openGet(@PathVariable("request") String request, HttpSession session) { | 103 | 103 | try { | 104 | 104 | request = URLDecoder.decode(request, StringUtil.UTF_8); | 105 | 105 | } catch (Exception e) { | |
|