IDE工具 idea

Java 1.8

数据库 MySQL

Maven apache-maven-3.6.0

SpringBoot的环境搭建

SpringBoot的环境搭建

点击next 选择依赖,可以先不选后期加。

直接next

SpringBoot的环境搭建

 修改阿里镜像

参照https://mp.csdn.net/postedit/88963755

SpringBoot的环境搭建

此时表结构为这样。

在pom.xml 中添加依赖,来开启web服务

  <!-- Spring boot 核心web-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

运行

SpringBoot的环境搭建 

服务开启

SpringBoot的环境搭建

测试:

新建 包结构

SpringBoot的环境搭建

interface :TestService


public interface TestService {
    public int test();
}

TestServiceImpl

@Service
public class TestServiceImpl  implements TestService {
    @Override
    public int test() {
        return 111111111;
    }
}

TestController


@Controller
@EnableAutoConfiguration
public class TestController {
    @Autowired
    TestService testService;

    @RequestMapping("/get")
    @ResponseBody
    public int get(){
        return testService.test();
    }

 

运行结果: 

SpringBoot的环境搭建 

整个Spring boot项目结构

SpringBoot的环境搭建

搭建完成

相关文章: