SpringBoot中Hello World例子

1.Hello World:

马克-to-win@马克java社区:做个普通java应用项目,像第一天我们学的java程序一样,之后导一堆包,参见我随视频带的项目,springBoot:



做一个普通类,MyController.java:

package com;

import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.stereotype.*;
import org.springframework.web.bind.annotation.*;

@Controller
//@EnableAutoConfiguration
@SpringBootApplication
public class MyController {

    @RequestMapping("/")
    @ResponseBody
    String myHome() {
          return "Hello 马克java社区 创始人 马克-to-win";
    }

    public static void main(String[] args) throws Exception {
        SpringApplication.run(MyController.class, args);
    }
}

像第一天学java一样,运行这个类。右击这个类:run as/java application:

版权保护,原文出处:http://www.mark-to-win.com/index.html?content=Frame/frameUrl.html&chapter=Frame/springBoot_web.html#SpringBootHelloWorld

猜你喜欢

转载自blog.csdn.net/mark_to_win/article/details/88732198