2021-08-05

This commit is contained in:
2021-08-05 13:33:52 +09:00
parent d45139dd58
commit 0f4d342354
32 changed files with 743 additions and 4 deletions

27
restful/build.gradle.kts Normal file
View File

@@ -0,0 +1,27 @@
/*
* Spring-boot Examples
*
* Copyright (c) 2021. Elex. All Rights Reserved.
* https://www.elex-project.com/
*/
plugins {
id("elex-spring-boot")
id("org.springframework.boot") version "2.5.3"
id("io.spring.dependency-management") version "1.0.11.RELEASE"
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-mustache")
compileOnly("org.projectlombok:lombok")
developmentOnly("org.springframework.boot:spring-boot-devtools")
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
annotationProcessor("org.projectlombok:lombok")
testImplementation("org.springframework.boot:spring-boot-starter-test")
}

View File

@@ -0,0 +1,13 @@
package kr.pe.elex.examples;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}

View File

@@ -0,0 +1,23 @@
package kr.pe.elex.examples;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.util.MimeType;
import org.springframework.util.MimeTypeUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import java.util.Random;
@Slf4j
@RestController
public class MainController {
@GetMapping(path = "/{name}", produces = {MimeTypeUtils.APPLICATION_JSON_VALUE})
public ResponseEntity<Person> home(@PathVariable String name) {
return ResponseEntity
.ok(new Person(name, new Random().nextInt()));
}
}

View File

@@ -0,0 +1,14 @@
package kr.pe.elex.examples;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class Person {
@JsonProperty
private String name;
@JsonProperty
private int age;
}

View File

@@ -0,0 +1 @@
package kr.pe.elex.examples;

View File

@@ -0,0 +1 @@