详解IDEA搭建springBoot方式一(推荐)
1.先在IDEA配置maven
maven下载和配置可以看https://www.jb51.net/article/197309.htm
2.新建maven项目
3.在pom.xml加入springBoot依赖
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.9.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies>
4.创建类(用来启动项目),写如下代码
package xiaoliu; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class SpringApplicationTest { public static void main(String[] args) { //启动spring应用 SpringApplication.run(SpringApplicationTest.class,args); } }
5.创建Controller 写代码如下
5.运行
6.访问项目
在页面中输入http://localhost:8080/hello 即可访问项目。
可以用idea 打包 成jar
然后用 java -jar hello.jar 运行springboot 项目
springboot中已经自带了tomcat,所以可以没有tomcat环境
到此这篇关于IDEA搭建springBoot方式一的文章就介绍到这了,更多相关IDEA搭建springBoot内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!
相关文章
IntelliJ IDEA使用maven实现tomcat的热部署
这篇文章主要介绍了IntelliJ IDEA使用maven实现tomcat的热部署,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧2018-07-07Java 报错 java.util.ConcurrentModificationException: null
这篇文章主要介绍了Java 报错 java.util.ConcurrentModificationException: null 的原因和解决方案,这个异常通常在多线程环境下出现,意味着在迭代过程中,集合或者映射的结构发生了变化,本文分享完美解决方案,需要的朋友可以参考下2023-07-07Java实现的生成二维码统计扫描次数并转发到某个地址功能详解
这篇文章主要介绍了Java实现的生成二维码统计扫描次数并转发到某个地址功能,可实现生成带统计功能的二维码,涉及java二维码的生成、参数传递、解析等相关操作技巧,需要的朋友可以参考下2018-07-07Spring Cloud Gateway 远程代码执行漏洞(CVE-2022-22947)的过程解析
Spring Cloud Gateway 是基于 Spring Framework 和 Spring Boot 构建的 API 网关,它旨在为微服务架构提供一种简单、有效、统一的 API 路由管理方式,这篇文章主要介绍了Spring Cloud Gateway 远程代码执行漏洞(CVE-2022-22947),需要的朋友可以参考下2022-08-08
最新评论