關於tarjan演算法的一些整理
阿新 • • 發佈:2021-11-14
一、入門案例
當前案例pom.xml配置
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.2.1.RELEASE</version> <relativePath/> <!-- lookup parent from repository --></parent>
<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> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-test</artifactId> <scope>test</scope> </dependency> </dependencies>
測試Controller
@RestController @RequestMapping("/test") public class TestController { @GetMapping("/hello") public String hello(){ return "Spring Security"; } }
演示效果:
當引入了security時,spring會自動實現認證功能,此時訪問http://localhost:8080/test/hello時,會自動跳轉到http://localhost:8080/login處;
預設使用者名稱:user
預設密碼:當前專案執行控制檯打印出來的uuid
此時通過使用者名稱和密碼可以正常進行認證;