spring  boot CLI 下载安装 配置环境变量

spring boot(一)


cmd输入

spring boot(一)



第一个web应用

@SpringBootApplication
//@EnableEurekaClient
@RestController
public class MicroserviceProviderUserApplication {

   @GetMapping("/hello/{name}")
   public String hello(@PathVariable String name){
      System.out.println(name+" welcome . My is microservice provider user");
      return name+" welcome . I'm microservice provider user";
   }
   public static void main(String[] args) {
      SpringApplication.run(MicroserviceProviderUserApplication.class, args);
   }
}

server.port=8081

启动后浏览器请求http://localhost:8081/hello/zhu

若是用命令行启动mvn spring-boot:run

No plugin found for prefix ‘spring-boot’ in the current project

 解决办法:pom.xml加入

<repositories>
   <repository>
      <id>spring-releases</id>
      <url>https://repo.spring.io/libs-release</url>
   </repository>
</repositories>
<pluginRepositories>
   <pluginRepository>
      <id>spring-releases</id>
      <url>https://repo.spring.io/libs-release</url>
   </pluginRepository>
</pluginRepositories>
然后命令行进入包含该pom.xml的目录下启动

2 Unable to find a single main class

解决办法:一个jar只能有一个main方法 

相关文章:

  • 2022-12-23
  • 2021-04-30
  • 2021-12-07
  • 2021-05-29
  • 2021-12-29
  • 2021-11-20
  • 2021-12-03
  • 2021-10-08
猜你喜欢
  • 2021-10-04
  • 2021-10-11
  • 2022-12-23
相关资源
相似解决方案