Meaven搭建springboot项目
2024-08-31 17:59:28
1.创建一个简单的maven project项目
2.项目目录结构
**注意启动类的位置:
3.pom.xml 配置jar包
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
<relativePath/>
</parent> <dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
4、创建一个SpringBoot项目运行的启动类
package com.lxp.Application; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication
public class StartApplication {
public static void main(String[] args) {
SpringApplication.run(StartApplication.class, args);
}
}
5、创建一个controller(@Controller只返回页面;@RestController返回json格式的数据)
package com.lxp.controller; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; @RestController
public class HelloWordController { @RequestMapping("hello")
public String hello() { return "HelloWord";
} }
6.查看效果
最新文章
- Android 如何有效的解决内存泄漏的问题
- sql语句查询经纬度范围(转载,源链接失效)
- Python for Informatics 第11章 正则表达式五(译)
- mvc局部视图
- URAL - 1920 Titan Ruins: the Infinite Power of Magic(乱搞)
- 如何在mac上安装gradle
- 笔记13:File 类的一些操作
- html 元素 变小手
- 关于学习Scala语言的一些感悟
- Discount Diesel Time 9150-1 Quartz Wrist watch [WAT022]- US$4.49
- bzoj2120: 数颜色 [莫队][分块]
- HTML文本
- pip安装selenium报错:Read timed out
- HALCON学习笔记
- dubbo源码之服务消费
- Spring Boot 揭秘与实战(五) 服务器篇 - 内嵌的服务器 Tomcat剖析
- flask中路由的本质源码分析
- GADL针对矢量数据格式转换的实用工具 —— ogr2ogr
- feign中的hytrix和turbin配置
- hadoop HA sshfen切换隔离时无法跳转ssh: bash: fuser: 未找到命令