springboot集合springsecurity,thymeleaf,springweb的依赖
时间: 2023-11-04 07:29:33 浏览: 85
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
相关问题
springboot集合springsecurity,thymeleaf的pom.xml,要有注释
```xml
<!-- Spring Boot Starter Parent -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<!-- Spring Boot Starter Web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Spring Security -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!-- Thymeleaf -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!-- Thymeleaf Spring Security -->
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity5</artifactId>
</dependency>
<!-- Spring Boot Starter Test -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
```
注释说明:
1. Spring Boot Starter Parent:Spring Boot 的父级依赖,定义了 Spring Boot 的版本和依赖管理。
2. Spring Boot Starter Web:Spring Boot Web 组件的依赖,包含了 Spring MVC、Tomcat 等。
3. Spring Security:Spring Security 组件的依赖,提供了安全认证和授权功能。
4. Thymeleaf:Thymeleaf 模板引擎的依赖,用于生成 HTML 页面。
5. Thymeleaf Spring Security:Thymeleaf 和 Spring Security 集成的依赖,提供了 Thymeleaf 中使用 Spring Security 的标签和属性。
6. Spring Boot Starter Test:Spring Boot 测试组件的依赖,包含了 JUnit、Mockito 等。
springboot集合springsecurity的依赖
在使用Spring Boot集成Spring Security时,需要在pom.xml文件中添加以下依赖:
```
<dependencies>
<!-- Spring Security -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!-- Spring Web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Thymeleaf -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!-- Spring Security Test -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
```
其中,spring-boot-starter-security是Spring Security的起步依赖,spring-boot-starter-web是Spring Web的起步依赖,spring-boot-starter-thymeleaf是Thymeleaf的起步依赖,spring-security-test是Spring Security的测试依赖。
阅读全文