19、(2.5分)Spring Boot 中集成 Freemarker 需要引入哪个依赖 A、spring-boot-starter-thymeleaf B、 spring-boot-starter-jetty C、 spring-boot-starter-freemarker D、spring-boot-starter-tomcat
时间: 2023-07-09 20:36:14 浏览: 162
C、`spring-boot-starter-freemarker`。在Spring Boot中集成Freemarker需要引入`spring-boot-starter-freemarker`依赖,例如:
```xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
```
这个依赖会自动引入Freemarker的核心依赖`freemarker`,以及Spring Boot提供的Freemarker支持依赖`spring-boot-starter-template`。其他选项中,`spring-boot-starter-thymeleaf`是用于集成Thymeleaf模板引擎的依赖;`spring-boot-starter-jetty`和`spring-boot-starter-tomcat`是用于集成Web容器的依赖,与集成Freemarker无关。
相关问题
19、 (2.5分)Spring Boot 中集成 Thymeleaf 需要引入哪个依赖A、 spring-boot-starter-freemarker B、 spring-boot-starter-thymeleaf C、 spring-boot-starter-jetty D、spring-boot-starter-tomcat
B、spring-boot-starter-thymeleaf。在Spring Boot中集成Thymeleaf需要引入spring-boot-starter-thymeleaf依赖。这个依赖包含了Thymeleaf模板引擎、Spring的模板引擎抽象层和Spring的模板引擎自动配置等相关组件。其他选项中,A描述的是集成FreeMarker模板引擎的依赖,C和D描述的是集成Web服务器的依赖,都和集成Thymeleaf没有直接关系。
spring-boot-starter spring-boot-starter-web parent 区别
Spring Boot Starter 和 Spring Boot Starter Web 都是 Spring Boot 提供的一系列方便快速启动新项目的依赖集,但它们有以下区别:
1. **Spring Boot Starter**:这是一个基础的集合,包含了Spring框架的核心组件,如Bean自动配置、日志处理、JPA等。它为构建基本的Spring应用提供了一个起点,不包含Web开发相关的特性和工具。
2. **Spring Boot Starter Web**:这是在Spring Boot Starter的基础上添加了Web开发相关的功能,比如Spring MVC、Tomcat服务器、HTML模板引擎(Thymeleaf或Freemarker)、静态资源管理等。如果你的应用需要提供HTTP服务,那么这个starter非常适合。
当你在Maven或Gradle项目中选择`spring-boot-starter`作为父依赖,项目将只包含通用的功能;而选择`spring-boot-starter-web`作为父依赖,除了通用模块外,还额外包括了web开发的支持。
阅读全文
相关推荐
![-](https://img-home.csdnimg.cn/images/20241231044955.png)
![-](https://img-home.csdnimg.cn/images/20241231044901.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)