IDEA搭建SpringMVC简单接口框架(Maven项目)
2021-04-19 06:26
标签:variable nal 新建 cat pos spring odi 接口 next
源码路径:https://github.com/winn-hu/interface
1, 新建项目,选择Maven,如图一次选择,最后点击Next
2, 输入GroupId和ArtifactId,点击Next
3,根据需要选择自定义maven配置,点击Next。(①可以直接跳过)
4,根据需要修改项目名称(一般不用修改),点击Finish。(①可以直接跳过)

6,修改pom.xml,添加依赖包
org.springframework spring-webmvc4.3.5.RELEASE


package com.blueStarWei.controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/hello") public class HelloWorld { @RequestMapping("/say/{name}") public String say(@PathVariable String name){ return "Hello World, "+name; } }
9,配置applicationContext.xml
10,配置web.xml
springmvc org.springframework.web.servlet.DispatcherServlet 1 springmvc /
11,创建springmvc-servlet.xml
12, 配置tomcat.(⑦和⑧可以跳过)
13,项目配置完成,可以启动服务器,(使用浏览器活postman等)进行访问。
IDEA搭建SpringMVC简单接口框架(Maven项目)
标签:variable nal 新建 cat pos spring odi 接口 next
原文地址:https://www.cnblogs.com/BlueStarWei/p/13290142.html
文章标题:IDEA搭建SpringMVC简单接口框架(Maven项目)
文章链接:http://soscw.com/index.php/essay/76533.html