Open conchincradle opened 1 year ago
package com.zhu.techcommunity.controller;
import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody;
@Controller @RequestMapping("/hello") public class HelloController { @RequestMapping("/hello") @ResponseBody public String sayHello(){ return "Hello! Spring Boot!"; }
}
access the link
http://localhost:8080/tech-community/hello/hello
Hello class - > hello so hello/hello
and tech-community default path
package com.zhu.techcommunity.controller;
import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody;
@Controller @RequestMapping("/hello") public class HelloController { @RequestMapping("/hello") @ResponseBody public String sayHello(){ return "Hello! Spring Boot!"; }
}