IDEA Spring Boot Create Project

1创建项目

下一步

创建完成

设置端口和IP

新建HelloController

package com.young.springboot3;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@SpringBootApplication
public class HelloController {
    @RequestMapping("/hello")
    public String hello(){
        return "Hello World! 哈哈哈";
    }
}

主函数中引入包调用

package com.young.springboot3;

import com.young.springboot3.HelloController;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Springboot3Application {

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

}

启动项目后访问接口

http://localhost:8089/hello

成功,O(∩_∩)O哈哈~

安装完成后,选择文件>设置>插件

安装Alibaba Java Coding Guidelines,规范编码的插件

猜你喜欢

转载自blog.csdn.net/m0_37137902/article/details/128841167
今日推荐