启动成功后报错:Disconnected from the target VM, address: '127.0.0.1:56597', transport: 'socket'
查看pom文件发现只有 spring-boot-starter
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
增加spring-boot-starter-web,starter可以去掉
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
看下spring-boot-starter管理的的jar包:
再看下spring-boot-starter-web管理的jar包:
可以看出spring-boot-starter-web包含了spring-boot-starter,所以使用spring-boot-starter-web就等于是有了spring-boot-starter的功能,除非只是要使用spring-boot-starter启动项目或者日志功能,而又不想引用过多的jar包时才用spring-boot-starter。