美文网首页
spring初始插件

spring初始插件

作者: Steppe | 来源:发表于2022-04-02 19:51 被阅读0次

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>

spring打包配置

<build>

<plugins>

<plugin>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-maven-plugin</artifactId>

</plugin>

</plugins>

</build>

打包运行

点击idea右侧maven点击package控制台jar的文件

复制文件路径cmd运行jar

命令java-jarspring-boot-01-helloworld-1.0-SNAPSHOT.jar

注解

@springBootApplication是springboot运行类的注解

运行主函数入口需要执行SpringApplication.run(类名.class,参数args)

packagecom.machunliang;

importorg.springframework.boot.SpringApplication;

importorg.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication

publicclassHelloWorldApplication{

publicstaticvoidmain(String[]args) {

SpringApplication.run(HelloWorldApplication.class,args);

   }

}

相关文章

网友评论

      本文标题:spring初始插件

      本文链接:https://www.haomeiwen.com/subject/fxfxsrtx.html