1.第一步打开File->New->Project,SDK根据自己的需要选择,我这边选的是java7
2.Next之后 设置group 和artifact,根据自己的需要进行修改。
3.导包,这里导入一个Web包就可以了。
4,一直下一步,生成项目,在src下找到xxxApplication.java,进行修改后如下.
@SpringBootApplication @RestController public class SpringBootDemoApplication { public static void main(String[] args) { SpringApplication.run(SpringBootDemoApplication.class, args); } @RequestMapping("/helloworld") public String hello(){ System.out.print("helloworld"); return "hello"; }
5,Run 运行application应用,用浏览器打开 localhost:8080/helloworld ,/helloworld 对应上面的RequestMapping("/helloworld"),第一个springBoot程序完成。