io.springfox: springfox-boot-Starter: 3.0.0
zum Gradle hinzu--Erstellen Sie ein neues Projekt, indem Sie in Spring Initializr Spring Web auswählen
package com.example.demo.api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RestController
@RequestMapping("/api/demo")
public class DemoController {
@GetMapping("/customers")
public String[] customers() {
return new String[] {
"AIUEO",
"Kakikukeko",
"SA Shi Su Se So."
};
}
@GetMapping("/customer/{id}")
public Map<String, String> customer(@PathVariable String id) {
return Map.of(
"id", id,
"name", "Name",
"address", "Tokio");
}
}
build.gradle
implementation "io.springfox:springfox-boot-starter:3.0.0"