idea搭spring boot项目

Spring Boot是由Pivotal团队提供的全新框架,设计目的是用来简化新Spring应用的初始搭建以及开发过程。它主要推崇的是'消灭配置’,实现零配置。

那么,如何在idea中创建一个springboot项目呢?

1.创建项目

File-New-Project

next

next

next

finish

成功创建web项目,目录结构如下

 2.编写controller

package com.example.demo55;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class hiWorld {
    @RequestMapping(value="/hello")
    public String say(){
        String str="my spring boot web project hihihi";
        System.out.println(str);
        return str;
    }

 
}

最终结果目录结果如下:

3.启动

 4.验证

http://127.0.0.1:8080/hello

猜你喜欢

转载自www.cnblogs.com/pu20065226/p/10757560.html