Spring boot maven项目 准备+启动

1.创建maven项目(next next next)


2.安装 JBLJavaToWeb插件
file->setting->plugins
搜索JBLJavaToWeb
在这里插入图片描述

3.右右右击项目名 ,点击 JBLJavaToWeb
效果:增加了webapp包
在这里插入图片描述


4.file -> Build, Execution , Deployment -> Build Tools 下的 Maven Runner

右边小框中VM(加上下面这句,如果本地仓库没有依赖包,从远处爬取):
-DarchetypeCatalog=internal -Dfile.encoding=UTF-8
在这里插入图片描述


5.pom.xml 中带上这两句

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.7.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
  </parent>

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

在这里插入图片描述

6.java下建一个com包,再建一个启动类

package com;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

//三个注解的合并注解
@SpringBootApplication
public class Ling {
    
    
	//主函数启动
    public static void main(String[] args) {
    
    
    	//启动方法
        SpringApplication.run(Ling.class,args);
    }
}

猜你喜欢

转载自blog.csdn.net/BOWWOB/article/details/111361634