<artifactId>spring-boot-starter-thymeleaf</artifactId>和<artifactId>spring-boot-starter-web</artifactId>作用与区别
时间: 2023-12-17 15:14:57 浏览: 98
`<artifactId>spring-boot-starter-thymeleaf</artifactId>` 是 Spring Boot 中集成 Thymeleaf 模板引擎的依赖包,它包括了 Thymeleaf 相关的依赖库和 Spring Boot 集成 Thymeleaf 所需的配置。使用 Thymeleaf 可以方便地在前端页面中进行数据渲染和逻辑处理。
`<artifactId>spring-boot-starter-web</artifactId>` 是 Spring Boot 中集成 Web 应用开发的依赖包,它包含了常用的 Web 相关的依赖库以及 Spring Boot 集成 Web 应用所需的配置。使用该依赖包可以快速构建 Web 应用。
它们的区别在于 `spring-boot-starter-thymeleaf` 是针对使用 Thymeleaf 模板引擎的 Web 应用场景,而 `spring-boot-starter-web` 是针对 Web 应用开发的通用依赖包。在使用 Thymeleaf 的时候,需要同时引入这两个依赖包,以便实现完整的 Web 应用开发。
相关问题
<artifactId>spring-boot-starter-thymeleaf</artifactId>和<artifactId>spring-boot-starter-web</artifactId>区别
`<artifactId>spring-boot-starter-thymeleaf</artifactId>`是Spring Boot提供的用于在Web应用程序中使用Thymeleaf模板引擎的Starter依赖。Thymeleaf是一种现代化的服务器端Java模板引擎,它可以在Web和独立环境中处理HTML、XML、JavaScript、CSS和文本等类型的模板。
`<artifactId>spring-boot-starter-web</artifactId>`是Spring Boot提供的用于构建Web应用程序的Starter依赖。它包含了Spring MVC、HTTP消息转换器、Tomcat和其他与Web应用程序相关的依赖项。它可以让你快速构建一个Web应用程序并且使得开发过程变得更加简单。
因此,`<artifactId>spring-boot-starter-thymeleaf</artifactId>`和`<artifactId>spring-boot-starter-web</artifactId>`都是Spring Boot提供的用于构建Web应用程序的Starter依赖,但它们的侧重点不同,前者主要是提供了Thymeleaf模板引擎的支持,后者则涵盖了更广泛的Web应用程序开发相关依赖。
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!--注册中心客户端--> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> </dependency> <!--配置中心客户端--> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-oauth2-authorization-server</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot-starter</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-openfeign</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-loadbalancer</artifactId> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </dependency> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-gateway</artifactId> </dependency> 以上的依赖中哪个与gateway冲突
以上的依赖项中并没有与Spring Cloud Gateway直接冲突的依赖项。但是请注意,这些依赖项中有些可能会和Spring Cloud Gateway的一些依赖项产生间接冲突,例如spring-boot-starter-web和spring-boot-starter-security等。如果您遇到了冲突问题,请根据具体情况进行调整和处理。
阅读全文