1. File->New->spring initializr
dependency 选择 web web
2.修改maven配置路径,指向本地的maven仓库
File->build.excution.Deployment->Build tools->Maven
Maven home directory 修改为
E:/maven/apache-maven-3.6.0
maven 配置:
E:\maven\apache-maven-3.6.0\conf\setting.xml
<localRepository>E:/maven/localresp</localRepository>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
3.Controller代码
New->java class
HelloConroller
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
@RequestMapping("/")
public String sayHello(){
return "hello world";
}
}
4.