eclipse的springboot搭建

eclipse的springboot搭建

首先在eclipse中安装spring boot所需要的插件,Help下的Eclipse Markplace下选择Popular找到对应的软件安装
eclipse的springboot搭建_第1张图片
创建项目:选择spring Starter Project
eclipse的springboot搭建_第2张图片
eclipse的springboot搭建_第3张图片
eclipse的springboot搭建_第4张图片
以上项目创建完毕

添加测试类
eclipse的springboot搭建_第5张图片

package com.example.demo;

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

import com.Entry.User;

@RestController
public class HelloWorldController {
    
	@RequestMapping("/hello")
    public String index() {
        return "Hello World";
    }
    
	@RequestMapping("/getUser")
    public User getUser() {
    	User user=new User();
    	user.setUserName("黄渤");
    	user.setAge("1234");
        return user;
    }
    
}

启动spring boot
eclipse的springboot搭建_第6张图片
访问浏览器:http://localhost:8080/hello

你可能感兴趣的:(spring,boot,spring,boot)