Skip to content
Snippets Groups Projects
Commit 4d453bc6 authored by 정 의찬's avatar 정 의찬
Browse files

RestController parameter test

parent a8de9a6d
No related branches found
No related tags found
No related merge requests found
......@@ -13,9 +13,4 @@ public class DemoApplication {
SpringApplication.run(DemoApplication.class, args);
}
@GetMapping(value="/")
public String HelloWorld(){
return "Hello World";
}
}
......@@ -5,18 +5,24 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.google.gson.JsonObject;
@RestController
public class TestController {
@GetMapping(value = "/test")
public UserDto test() {
@RequestMapping(value = "/", method = RequestMethod.GET)
public String test(@RequestParam("id") String id){
JsonObject obj = new JsonObject();
obj.addProperty("title", "산사와 아가싸");
obj.addProperty("content", "로맨틱 코메디");
UserDto dto = new UserDto();
dto.setAge(17);
dto.setName("Jane");
JsonObject data = new JsonObject();
data.addProperty("time", "토일 8시");
obj.add("data", data);
return dto;
return obj.toString();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment