parent
81e00a5343
commit
e1d1987fad
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
Binary file not shown.
@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.4.0</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>top.lejings</groupId>
|
||||
<artifactId>http_demo</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>http_demo</name>
|
||||
<description>http_demo</description>
|
||||
<url/>
|
||||
<licenses>
|
||||
<license/>
|
||||
</licenses>
|
||||
<developers>
|
||||
<developer/>
|
||||
</developers>
|
||||
<scm>
|
||||
<connection/>
|
||||
<developerConnection/>
|
||||
<tag/>
|
||||
<url/>
|
||||
</scm>
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
@ -0,0 +1,13 @@
|
||||
package top.lejings.http_demo;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class HttpDemoApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(HttpDemoApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package top.lejings.http_demo;
|
||||
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class Path {
|
||||
//路径参数
|
||||
|
||||
@RequestMapping("/path/{id}")
|
||||
public String pathParam(@PathVariable Integer id) {
|
||||
System.out.println("id:" + id);
|
||||
return "pathParam:" + id;
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package top.lejings.http_demo;
|
||||
|
||||
//数组集合参数
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
public class list {
|
||||
|
||||
// //数组
|
||||
// @RequestMapping("/arrayParam")
|
||||
// public String arrayParam(String[] hobby){
|
||||
// System.out.println(Arrays.toString(hobby));
|
||||
// return "ArrayOk";
|
||||
// }
|
||||
|
||||
//集合
|
||||
@RequestMapping("/listParam")
|
||||
public String listParam(@RequestParam List<String> hobby){
|
||||
System.out.println(hobby);
|
||||
return "ListOk";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package top.lejings.http_demo.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Address {
|
||||
private String province;
|
||||
private String city;
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package top.lejings.http_demo.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class User {
|
||||
private String name;
|
||||
private Integer age;
|
||||
private Address address;
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package top.lejings.http_demo;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import top.lejings.http_demo.pojo.User;
|
||||
|
||||
@RestController
|
||||
public class time_json {
|
||||
//日期时间
|
||||
|
||||
//json
|
||||
@RequestMapping("/jsonParam")
|
||||
public String jsonParam(@RequestBody User user){
|
||||
System.out.println(user);
|
||||
return "jsonOk";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1 @@
|
||||
spring.application.name=http_demo
|
@ -0,0 +1,13 @@
|
||||
package top.lejings.http_demo;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class HttpDemoApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1 @@
|
||||
spring.application.name=http_demo
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
||||
spring.application.name=spring-webai-quickstart
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue