Spring Boot的主要優勢:web
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;spring
@Controller
public class helloController {app
@ResponseBody @RequestMapping("/hello") public String hello(){ return "hello world!"; }
}maven
@SpringBootApplication
public class helloMailApplication {
public static void main(String[] args) {
SpringApplication.run(helloMailApplication.class,args);
}
}spring-boot
運行效果以下:
code
在web端訪問 http://localhost:8080/hello
xml