我们知道在springboot中如果要使用springmvc等web功能,需要引入如下starter,
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>
你可能会问,如果我想引入jdbc,想在springboot中引入mq相关的starter(前边已经说过就是jar包集合)该怎么写呢?也就是说有没有一个地方可以看到springboot的starter列表,有多少starters?可以参考下面这个网址:
https://docs.spring.io/spring-boot/docs/2.0.2.RELEASE/reference/htmlsingle/#using-boot-starter,如下图我截取了部分starter列表:
比如我想使用java mail方面的功能就可以找到使用的依赖是:
<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> </dependency> <dependency> <groupId>com.sun.mail</groupId> <artifactId>javax.mail</artifactId> </dependency> </dependencies>
而我在项目里面只需写:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-mail</artifactId> </dependency>