spring boot(一)

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


cmd输入




第一个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方法 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值