最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

SpringSecurity默認(rèn)登錄頁的使用示例教程

 更新時間:2023年12月05日 09:23:16   作者:宣布無人罪  
Spring 是非常流行和成功的 Java 應(yīng)用開發(fā)框架,Spring Security 正是 Spring 家族中的成員,Spring Security 基于 Spring 框架,提供了一套 Web 應(yīng)用安全性的完整解決方案,本文給大家介紹SpringSecurity的默認(rèn)登錄頁的使用教程,感興趣的朋友一起看看吧

SpringSecurity的默認(rèn)登錄頁的使用

01 前期準(zhǔn)備

引入依賴

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
		<!--mysql驅(qū)動-->
        <dependency>
            <groupId>com.mysql</groupId>
            <artifactId>mysql-connector-j</artifactId>
            <scope>runtime</scope>
        </dependency>
		<!--模塊化插件配置類-->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <!--mybatisplus依賴-->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.5.1</version>
        </dependency>
		<!--spring-security依賴-->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>

配置系統(tǒng)文件

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/(需要連接的數(shù)據(jù)庫)?userSSL=false;serverTimezone=Asia/Shanghai
    username: (賬號)
    password: (密碼)
  mvc:
    pathmatch:
      matching-strategy: ant_path_matcher
mybatis-plus:
  config-locations: classpath:mapper/*.xml
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

配置掃描包

@SpringBootApplication
@MapperScan("com.example.demo.mapper")
public class DemoApplication {
    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}

02 編寫測試接口

測試類

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Category {
  @TableId
  private Long categoryId;
  private String categoryName;
  private String categoryPicture1;
  private String categoryPicture2;
}

測試用的控制層接口

@RestController
@RequestMapping("category")
public class CategoryController {
     @Autowired
     private ICategoryService iCategoryService;
    @GetMapping("all")
    public GetData selectAll(){
        List<Category> categories=iCategoryService.list();
        GetData getData = new GetData(200,"查詢成功",categories);
        return getData;
    }
    @GetMapping("byId")
    public GetData selectDetail(Long id){
        Category category=iCategoryService.getById(id);
        GetData getData = new GetData(200,"查詢成功",category);
        return getData;
    }
}

03 啟動項目

啟動之后,會自動生成默認(rèn)密碼

在這里插入圖片描述

  • Using generated security password: 8d97e198-138c-4093-9a5c-ac83e2dda426
  • 這時候訪問接口被spring-security默認(rèn)攔截,必須登錄后才能訪問

在這里插入圖片描述

  • 默認(rèn)界面的賬號默認(rèn)user,密碼是Using generated security password隨機生成的 

到此這篇關(guān)于SpringSecurity的默認(rèn)登錄頁的使用的文章就介紹到這了,更多相關(guān)SpringSecurity默認(rèn)登錄頁內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • maven項目無法讀取到resource文件夾的問題

    maven項目無法讀取到resource文件夾的問題

    這篇文章主要介紹了maven項目無法讀取到resource文件夾的問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2021-11-11
  • Java中實現(xiàn)代碼優(yōu)化的技巧分享

    Java中實現(xiàn)代碼優(yōu)化的技巧分享

    這篇文章主要跟大家談?wù)剝?yōu)化這個話題,那么我們一起聊聊Java中如何實現(xiàn)代碼優(yōu)化這個問題,小編這里有幾個實用的小技巧分享給大家,需要的可以參考一下
    2022-08-08
  • Java基礎(chǔ)之容器LinkedList

    Java基礎(chǔ)之容器LinkedList

    這篇文章主要介紹了Java基礎(chǔ)之容器LinkedList,文中有非常詳細(xì)的代碼示例,對正在學(xué)習(xí)java基礎(chǔ)的小伙伴們有非常好的幫助,需要的朋友可以參考下
    2021-04-04
  • JavaWeb案例講解Servlet常用對象

    JavaWeb案例講解Servlet常用對象

    Java Servlet 是運行在 Web 服務(wù)器或應(yīng)用服務(wù)器上的程序,它是作為來自 Web 瀏覽器或其他 HTTP 客戶端的請求和 HTTP 服務(wù)器上的數(shù)據(jù)庫或應(yīng)用程序之間的中間層
    2021-10-10
  • springboot從application.properties中注入list,?map方式

    springboot從application.properties中注入list,?map方式

    這篇文章主要介紹了springboot從application.properties中注入list,map方式,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2021-11-11
  • Intellij IDEA 2017.3使用Lombok及常用注解介紹

    Intellij IDEA 2017.3使用Lombok及常用注解介紹

    這篇文章主要介紹了Intellij IDEA 2017.3使用Lombok及常用注解介紹,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-09-09
  • 阿里云部署SpringBoot項目啟動后被殺進(jìn)程的問題解析

    阿里云部署SpringBoot項目啟動后被殺進(jìn)程的問題解析

    這篇文章主要介紹了阿里云部署SpringBoot項目啟動后被殺進(jìn)程的問題,本文給大家分享問題原因所在及解決步驟,需要的朋友可以參考下
    2023-09-09
  • Java中BigDecimal除法使用不當(dāng)導(dǎo)致精度問題

    Java中BigDecimal除法使用不當(dāng)導(dǎo)致精度問題

    本文主要介紹了Java中BigDecimal除法使用不當(dāng)導(dǎo)致精度問題,文中通過示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2021-11-11
  • SpringCloud的全鏈路灰度發(fā)布方案詳解

    SpringCloud的全鏈路灰度發(fā)布方案詳解

    這篇文章主要介紹了SpringCloud的全鏈路灰度發(fā)布方案詳解,灰度發(fā)布(又名金絲雀發(fā)布)是指在黑與白之間,能夠平滑過渡的一種發(fā)布方式,灰度發(fā)布可以保證系統(tǒng)的穩(wěn)定性,?在初始灰度的時候可以發(fā)現(xiàn),?調(diào)整問題,?保證其影響度,需要的朋友可以參考下
    2023-09-09
  • Java之Swagger配置掃描接口以及開關(guān)案例講解

    Java之Swagger配置掃描接口以及開關(guān)案例講解

    這篇文章主要介紹了Java之Swagger配置掃描接口以及開關(guān)案例講解,本篇文章通過簡要的案例,講解了該項技術(shù)的了解與使用,以下就是詳細(xì)內(nèi)容,需要的朋友可以參考下
    2021-08-08

最新評論

肃北| 台中县| 永丰县| 凌云县| 洛川县| 赤水市| 甘德县| 玛沁县| 松潘县| 巴中市| 三台县| 华容县| 齐齐哈尔市| 铅山县| 汝城县| 交口县| 宜兰县| 鹤峰县| 青阳县| 登封市| 社会| 南华县| 耒阳市| 正镶白旗| 元朗区| 洛隆县| 偃师市| 平利县| 宁陵县| 大城县| 璧山县| 铜山县| 大冶市| 玉树县| 乳源| 铜陵市| 吕梁市| 南通市| 娄底市| 福泉市| 南宫市|