一步步搭建快速开发web项目系列 2.集成springmvc可以网页访问成功

版权声明:第一次写文章,有什么需要补充的还望各位大神多多指教。 https://blog.csdn.net/mengxiangxingdong/article/details/83828238

目标

集成springmvc可以网页访问成功
在上一篇文章中我们创建了基础的springboot项目,现在我们引入springmvc ,并且访问页面能够成功

项目地址

https://gitee.com/hugo110/springboot-boot

大纲

https://blog.csdn.net/mengxiangxingdong/article/details/83827969

开始

1.pom.xml中增加

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>

2.com.xmindguoguo.boot.core.demo 包中新建SpringMvcDemo
SpringMvcDemo.java

@Controller
@RequestMapping
public class SpringMvcDemo {
    @RequestMapping("springmvcDemo")
    @ResponseBody
    public String springmvcDemo() {
        return "hello springmvcDemo";
    }
}

启动BootApplication.java
在浏览器中访问 http://localhost:8080/springmvcDemo
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/mengxiangxingdong/article/details/83828238