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 { ...@@ -13,9 +13,4 @@ public class DemoApplication {
SpringApplication.run(DemoApplication.class, args); SpringApplication.run(DemoApplication.class, args);
} }
@GetMapping(value="/")
public String HelloWorld(){
return "Hello World";
}
} }
...@@ -5,18 +5,24 @@ import org.springframework.web.bind.annotation.RequestMethod; ...@@ -5,18 +5,24 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.google.gson.JsonObject;
@RestController @RestController
public class TestController { public class TestController {
@GetMapping(value = "/test") @RequestMapping(value = "/", method = RequestMethod.GET)
public UserDto test() { public String test(@RequestParam("id") String id){
JsonObject obj = new JsonObject();
obj.addProperty("title", "산사와 아가싸");
obj.addProperty("content", "로맨틱 코메디");
UserDto dto = new UserDto(); JsonObject data = new JsonObject();
dto.setAge(17); data.addProperty("time", "토일 8시");
dto.setName("Jane"); 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