Spring MVC(Model-View-Controller)

@Controller
public class SampleController {
private static final Logger logger = LoggerFactory.getLogger(SampleController.class);
@RequestMapping("/profile")
public String profile(){
logger.info("in profile");
return "/hello.html";
}
@RequestMapping(value = "/hello"
,method = RequestMethod.GET
)
public String hello(@RequestParam(name = "id",required = false,defaultValue = "")String name)
{
logger.info("Path : hello");
logger.info("Query Param id:" + name);
return "/hello.html";
}
@GetMapping(value = "/hello/{id}")
public String helloPath(@PathVariable("id") String id){
logger.info("Path Variable is " + id);
return "/hello.html";
}
@GetMapping(
"/get-profile"
)
public @ResponseBody SamplePayload getProfile(){
return new SamplePayload("ldkstellar",26,"Developer");
}
}
@RestController
@RequestMapping("/rest")
public class SampleRestController {
private static final Logger logger = LoggerFactory.getLogger(SampleController.class);
@GetMapping("/Sample-payload")
public SamplePayload SamplePayload(){
logger.info("SamplePayload complete!");
return new SamplePayload("ldkstellar",26,"Developer");
}
@GetMapping(value = "/sample-image",
produces = MediaType.IMAGE_PNG_VALUE
)
public byte[] SampleImage() throws IOException{
InputStream inputStream =getClass().getResourceAsStream("/static/k.PNG");
return inputStream.readAllBytes();
}
}