手把手教你如何优雅的使用idea建立属于你的第一个Sring Boot项目。 本次教程使用到的技术栈 String+Mybatis+Swagger+Mysql+Redisphp
环境安装请你们参考网上教程自行安装,遇到问题可私信 球球。html
打开Settings里面Plugins,勾选String Boot插件而后点击Apply,若是已经安装了可忽略次步骤 java
New Project 选择Spring Initializrgit
此处不够选的也不要紧能够在pom文件中自行添加依赖就好了github
.gitignore .mvn mvnw mvnw.cmd HELP.mdweb
此时你会发现,项目经过idea默认的maven依赖导入很漫长,这个等待的时间能够说是没法忍受的,因此须要切换maven的源地址spring
settings_ali.xml 配置文件sql
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>/myapp/m2/repo</localRepository>
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
</servers>
<mirrors>
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
</profiles>
</settings>
复制代码
若是你的项目没有自动设置java目录为源文件目录的话,须要手动设置apache
Java目录下右键->Mark Dicrectory as -> Sources Rootapp
package com.qiuqiu.boot.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/test")
public class TestController {
@RequestMapping("/get")
public String info(){
return "this is Spring Boot";
}
}
复制代码
访问地址 http://localhost:8080/test/get
未完待续。。。