国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

【spring】集成Web、druid、jdbcTemple實(shí)現(xiàn)免登錄時(shí)長(zhǎng)兩天半

這篇具有很好參考價(jià)值的文章主要介紹了【spring】集成Web、druid、jdbcTemple實(shí)現(xiàn)免登錄時(shí)長(zhǎng)兩天半。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問(wèn)。

CSDN話題挑戰(zhàn)賽第2期
參賽話題:學(xué)習(xí)筆記

*學(xué)習(xí)之路,長(zhǎng)路漫漫,寫(xiě)學(xué)習(xí)筆記的過(guò)程就是把知識(shí)講給自己聽(tīng)的過(guò)程。這個(gè)過(guò)程中,我們?nèi)ビ涗浰伎嫉倪^(guò)程,便于日后復(fù)習(xí),梳理自己的思路。學(xué)習(xí)之樂(lè),獨(dú)樂(lè)樂(lè),不如眾樂(lè)樂(lè),把知識(shí)講給更多的人聽(tīng),何樂(lè)而不為呢?

??博客x主頁(yè):己不由心王道長(zhǎng)??!
??文章說(shuō)明:spring??
?系列專(zhuān)欄:spring
??本篇內(nèi)容:使用spring、web監(jiān)聽(tīng)器、過(guò)濾器+servlet+druid+mybatis實(shí)現(xiàn)免登錄時(shí)長(zhǎng)兩天半(對(duì)所需知識(shí)點(diǎn)進(jìn)行選擇閱讀呀~)??
??每日一語(yǔ):人生寂寞是一種力量。人經(jīng)得起寂寞,就能獲得自由;耐不住寂寞,就會(huì)受人牽制。??
??作者詳情:作者是一名雙非大三在校生,喜歡Java,歡迎大家探討學(xué)習(xí),喜歡的話請(qǐng)給博主一個(gè)三連鼓勵(lì)。??

??前言

  • 凡事自己多動(dòng)手動(dòng)腦、聽(tīng)取他人優(yōu)秀的觀點(diǎn),做一個(gè)會(huì)學(xué)習(xí)的人。
??一、創(chuàng)建項(xiàng)目框架

在這里創(chuàng)建一個(gè)maven工程,選擇web模板,JDK選擇1.8:

druid不用登錄直接進(jìn)去,spring,spring,前端,java

創(chuàng)建maver工程以后,可能目錄結(jié)構(gòu)并不完整,接下來(lái)我們要構(gòu)建一個(gè)完整的目錄結(jié)構(gòu),只有完整的目錄結(jié)構(gòu),在后面部署在tomcat服務(wù)器上時(shí)才能正常使用。

補(bǔ)全maven目錄結(jié)構(gòu):打開(kāi)項(xiàng)目—>找到src目錄—>選中右鍵—>選擇新建(new)—>選擇目錄—>重復(fù)四次,直到把目錄補(bǔ)全。

druid不用登錄直接進(jìn)去,spring,spring,前端,java
druid不用登錄直接進(jìn)去,spring,spring,前端,java

至此我們就完全了一個(gè)工程的創(chuàng)建。

??二、導(dǎo)入前端頁(yè)面資源

要實(shí)現(xiàn)免登錄時(shí)長(zhǎng)兩天半,我們得找到前端資源,并導(dǎo)入我們的項(xiàng)目中。

前端資源怎么找?我這里提供了本次項(xiàng)目的前端資源,需要的可以私信我?;蛘咧苯铀阉鱦Query之家也可以獲取相應(yīng)資源

導(dǎo)入到哪里? 導(dǎo)入到項(xiàng)目下的Webapp目錄下
druid不用登錄直接進(jìn)去,spring,spring,前端,java

前端效果展示

druid不用登錄直接進(jìn)去,spring,spring,前端,java
druid不用登錄直接進(jìn)去,spring,spring,前端,java

前端頁(yè)面分析:可以看到兩個(gè)頁(yè)面是相互跳轉(zhuǎn)的,當(dāng)在登錄頁(yè)面填好密碼和賬號(hào)以后,點(diǎn)擊登錄就會(huì)向下經(jīng)過(guò)Web層調(diào)控,然后調(diào)用Sevice。。。往下查詢數(shù)據(jù)庫(kù)并返回查詢結(jié)構(gòu),有用戶存在則跳轉(zhuǎn)到歡迎頁(yè),沒(méi)有則跳轉(zhuǎn)登錄頁(yè)。相應(yīng)的注冊(cè)成功之后也跳轉(zhuǎn)到登錄頁(yè)面。在這個(gè)過(guò)程中使用過(guò)濾器過(guò)濾,沒(méi)有登錄則不能訪問(wèn)歡迎頁(yè),訪問(wèn)則直接跳轉(zhuǎn)到登錄頁(yè)。
druid不用登錄直接進(jìn)去,spring,spring,前端,java
通過(guò)分析,前端頁(yè)面要執(zhí)行的主要操作有兩個(gè)個(gè)。一個(gè)是登錄(login)、一個(gè)是注冊(cè)(register)。

druid不用登錄直接進(jìn)去,spring,spring,前端,java

??三、pom.xml依賴坐標(biāo)導(dǎo)入

在原先免登錄時(shí)長(zhǎng)兩天半的依賴上,本次結(jié)合了spring方法,使用的是xml格式開(kāi)發(fā)項(xiàng)目。需要導(dǎo)入spring依賴、測(cè)試依賴和spring集成web依賴。

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.example</groupId>
  <artifactId>spring-web</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>war</packaging>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>

  <dependencies>
<!--    添加測(cè)試依賴-->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
    </dependency>

<!--    添加mybatis依賴-->
    <dependency>
      <groupId>org.mybatis</groupId>
      <artifactId>mybatis</artifactId>
      <version>3.4.6</version>
    </dependency>
<!--   添加servlet依賴-->
      <!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
      <dependency>
          <groupId>javax.servlet</groupId>
          <artifactId>javax.servlet-api</artifactId>
          <version>4.0.1</version>
          <scope>provided</scope>
      </dependency>

      <!--    添加MySQL依賴-->
      <dependency>
          <groupId>mysql</groupId>
          <artifactId>mysql-connector-java</artifactId>
          <version>8.0.29</version>
      </dependency>

      <!--    添加jsp依賴-->
    <dependency>
      <groupId>javax.servlet.jsp</groupId>
      <artifactId>javax.servlet.jsp-api</artifactId>
      <version>2.2.1</version>
      <scope>provided</scope>
    </dependency>
   <!--   添加el表達(dá)式依賴-->
      <dependency>
          <groupId>javax.el</groupId>
          <artifactId>javax.el-api</artifactId>
          <version>3.0.0</version>
      </dependency>
<!--      添加jstl標(biāo)簽庫(kù)依賴-->
      <dependency>
          <groupId>javax.servlet.jsp.jstl</groupId>
          <artifactId>jstl-api</artifactId>
          <version>1.2</version>
      </dependency>

      <!--添加druid依賴-->
      <!-- https://mvnrepository.com/artifact/com.alibaba/druid -->
      <dependency>
          <groupId>com.alibaba</groupId>
          <artifactId>druid</artifactId>
          <version>1.1.10</version>
      </dependency>
     <!--添加spring依賴、添加core就行了。core包含了依賴注入和控制反轉(zhuǎn)-->
      <!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
      <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-core</artifactId>
          <version>5.3.22</version>
      </dependency>
      <!--添加spring-web集成-->
      <!-- https://mvnrepository.com/artifact/org.springframework/spring-web -->
      <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-web</artifactId>
          <version>5.3.22</version>
      </dependency>

  </dependencies>

</project>

??四、Web層(controller)層搭建

通過(guò)上面的分析,我們先創(chuàng)建兩個(gè)servlet,即LoginServlet、RegisterServlet。實(shí)現(xiàn)對(duì)應(yīng)接口,重寫(xiě)doGet、doPost方法,并在doPost方法中調(diào)用doGet方法。
druid不用登錄直接進(jìn)去,spring,spring,前端,java

??五、Spring、Spring集成Web

要使用Spring、大致分為以下幾步:

導(dǎo)入Spring依賴坐標(biāo): pom.xml文件已經(jīng)導(dǎo)入完畢。

編寫(xiě)核心配置文件applicationContext.xml: 不一定叫這個(gè)名兒。只是約定俗成而已,但是這個(gè)見(jiàn)名知意,推薦使用

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">

</beans>

Spring集成Web也分為下面幾步:
導(dǎo)入Spring-web依賴坐標(biāo): pom.xml文件已經(jīng)導(dǎo)入完畢。
druid不用登錄直接進(jìn)去,spring,spring,前端,java

配置ContextLoaderListener監(jiān)聽(tīng)器
首先思考一個(gè)問(wèn)題一個(gè)問(wèn)題,我們要用到Spring,那么Spring總得創(chuàng)建吧?怎么創(chuàng)建呢?是調(diào)用一次就new一次嗎?顯然不是,那到底什么時(shí)候創(chuàng)建,放在什么地方才能保存持久?。。。?br>答:使用監(jiān)聽(tīng)器在加載項(xiàng)目的時(shí)候創(chuàng)建,存儲(chǔ)在應(yīng)用域,應(yīng)用域范圍廣
druid不用登錄直接進(jìn)去,spring,spring,前端,java

在web層調(diào)用Spring

怎么獲取Spring的上下文對(duì)象,Spring-Web提供了一個(gè)工具WebApplicationContextUtils供使用者獲得應(yīng)用上下文對(duì)象,想使用,直接調(diào)用,一遍獲取前面都要加一個(gè)get,所以方法是getApplicationContext

package com.bipt.controller;


import com.bipt.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
* @author 不止于夢(mèng)想
* @date 2022/10/7 22:55
*/
public class LoginServlet extends HttpServlet {
   @Override
   protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
       //獲取servletContext上下文對(duì)象、Spring容器創(chuàng)建保留在這里。
       ServletContext servletContext = this.getServletContext();
       //獲取spring容器、傳入servletContext上下文對(duì)象
       ApplicationContext app = WebApplicationContextUtils.getWebApplicationContext(servletContext);
       //調(diào)用容器內(nèi)的方法、獲取容器內(nèi)的對(duì)象
       UserService userService = app.getBean(UserService.class);

   }

   @Override
   protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
       this.doGet(req, resp);
   }
}

至此,完成了Spring和Web的集成。

??六、Spring控制反轉(zhuǎn)和依賴注入
控制反轉(zhuǎn)IOC

控制反轉(zhuǎn)是Spring的一個(gè)特性,以前的對(duì)象是我們自己創(chuàng)建的,想要的時(shí)候就new一個(gè)。現(xiàn)在用到Spring、Spring是一個(gè)大容器,我們把對(duì)象的創(chuàng)建交給Spring,當(dāng)加載Spring配置文件時(shí),就會(huì)創(chuàng)建相應(yīng)的bean對(duì)象,并且保存在Spring容器中。
druid不用登錄直接進(jìn)去,spring,spring,前端,java

值得注意的是,id在Spring當(dāng)中作為唯一標(biāo)識(shí)、用來(lái)識(shí)別不同的bean,id不能相同!!
同一個(gè)類(lèi)型可以創(chuàng)建多個(gè),但要調(diào)整scope(范圍),scope里常用的singleton(單例)prototype(多例)。創(chuàng)建多個(gè)相同類(lèi)型時(shí),scope設(shè)置為prototype。默認(rèn)情況下是singleton(單例)。

依賴注入DI

用到spring,可以對(duì)程序進(jìn)行解耦合,但不代表沒(méi)有聯(lián)系。在Service層中想要調(diào)用Mapper層的方法,在過(guò)去要在Service層中添加Mapper層對(duì)象作為屬性,這屬于代碼層面的綁定死。

上面的綁定死肯定不是我們要的,那么怎么辦?通過(guò)Spring 依賴注入(DI)把相應(yīng)的需求在配置文件中進(jìn)行設(shè)置,把耦合關(guān)系從代碼中抽離出來(lái)。在配置文件中,我們需求改變的時(shí)候可以直接修改配置文件,而不用修改源代碼,這符合軟件設(shè)計(jì)的原則
druid不用登錄直接進(jìn)去,spring,spring,前端,java

??七、Spring整合druid數(shù)據(jù)庫(kù)連接池和加載jdbcTemple

druid(德魯伊)數(shù)據(jù)庫(kù)連接池是一個(gè)優(yōu)秀的工具,在這里我們整合其作為我們的一部分。同樣的,第一部分也是導(dǎo)入相應(yīng)的位置坐標(biāo)。
druid不用登錄直接進(jìn)去,spring,spring,前端,java
然后在spring核心配置文件進(jìn)入bean導(dǎo)入,這樣就可以在啟用時(shí)創(chuàng)建在ioc容器當(dāng)中。
druid不用登錄直接進(jìn)去,spring,spring,前端,java
這里我配置了一個(gè)jdbc.properties配置文件做為存儲(chǔ)jdbc代碼的地方。當(dāng)然,這里不配置也沒(méi)事。沒(méi)有配置則直接在value處添加相應(yīng)數(shù)據(jù)。例如在name=driver的property中的value也可以為:com.mysql.jdbc.driver
如果配置了配置文件,就把它引進(jìn)來(lái)即可,然后像上面一樣依次取值。

加載jdbcTemple

同樣的,需要導(dǎo)入相應(yīng)坐標(biāo),這個(gè)是spring關(guān)于jdbc的一個(gè)模板工具。

druid不用登錄直接進(jìn)去,spring,spring,前端,java
然后配置:
druid不用登錄直接進(jìn)去,spring,spring,前端,java
值得注意的是這個(gè)bean的參數(shù)name也叫dataSource,而ref后的dataSource是上面druid配置數(shù)據(jù)源的信息。
至此,已經(jīng)把druid、jdbcTemple與spring整合好了。

??八、集成Web、druid、jdbcTemple實(shí)現(xiàn)免登錄時(shí)長(zhǎng)兩天半

至此,進(jìn)入我們最后一步,具體的實(shí)現(xiàn)各個(gè)層面的應(yīng)用。

pom.xml文件
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.example</groupId>
  <artifactId>spring-web</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>war</packaging>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>

  <dependencies>
<!--    添加測(cè)試依賴-->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
    </dependency>

<!--    添加mybatis依賴-->
    <dependency>
      <groupId>org.mybatis</groupId>
      <artifactId>mybatis</artifactId>
      <version>3.4.6</version>
    </dependency>
<!--   添加servlet依賴-->
      <!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
      <dependency>
          <groupId>javax.servlet</groupId>
          <artifactId>javax.servlet-api</artifactId>
          <version>4.0.1</version>
          <scope>provided</scope>
      </dependency>

      <!--    添加MySQL依賴-->
      <dependency>
          <groupId>mysql</groupId>
          <artifactId>mysql-connector-java</artifactId>
          <version>8.0.29</version>
      </dependency>

      <!--    添加jsp依賴-->
    <dependency>
      <groupId>javax.servlet.jsp</groupId>
      <artifactId>javax.servlet.jsp-api</artifactId>
      <version>2.2.1</version>
      <scope>provided</scope>
    </dependency>
   <!--   添加el表達(dá)式依賴-->
      <dependency>
          <groupId>javax.el</groupId>
          <artifactId>javax.el-api</artifactId>
          <version>3.0.0</version>
      </dependency>
<!--      添加jstl標(biāo)簽庫(kù)依賴-->
      <dependency>
          <groupId>javax.servlet.jsp.jstl</groupId>
          <artifactId>jstl-api</artifactId>
          <version>1.2</version>
      </dependency>

      <!--添加druid依賴-->
      <!-- https://mvnrepository.com/artifact/com.alibaba/druid -->
      <dependency>
          <groupId>com.alibaba</groupId>
          <artifactId>druid</artifactId>
          <version>1.1.10</version>
      </dependency>
     <!--添加spring依賴、添加core就行了。core包含了依賴注入和控制反轉(zhuǎn)-->
      <!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
      <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-core</artifactId>
          <version>5.2.5.RELEASE</version>
      </dependency>

      <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-jdbc</artifactId>
      </dependency>
      <!--添加spring-web集成-->
      <!-- https://mvnrepository.com/artifact/org.springframework/spring-web -->
      <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-web</artifactId>
          <version>5.2.5.RELEASE</version>
      </dependency>
      <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-context</artifactId>
          <version>5.2.5.RELEASE</version>
          <scope>compile</scope>
      </dependency>

      <!-- spring事務(wù)依賴 -->
      <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-tx</artifactId>
          <version>5.2.5.RELEASE</version>
      </dependency>
      <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-jdbc</artifactId>
          <version>5.2.5.RELEASE</version>
      </dependency>

  </dependencies>

</project>
 
applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">

    <!--控制反轉(zhuǎn)+依賴注入-->
    <bean id="UserMapper" class="com.bipt.mapper.impl.implUserMapper">
        <property name="jdbcTemplate" ref="jdbcTemplate"></property>
    </bean>
    <bean id="UserService" class="com.bipt.service.implService.ImplUserService">
        <property name="userMapper" ref="UserMapper"></property>
    </bean>
   <!--加載導(dǎo)入配置文件-->
    <context:property-placeholder location="classpath:/dbConfig.properties"/>
    <!--配置數(shù)據(jù)源-->
    <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
        <property name="driverClassName" value="${jdbc.driver}"></property>
        <property name="url" value="${jdbc.url}"></property>
        <property name="username" value="${jdbc.username}"></property>
        <property name="password" value="${jdbc.password}"></property>
    </bean>
    <!--配置jdbcTemplate-->
    <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
        <property name="dataSource" ref="dataSource"></property>
    </bean>
</beans>

??總結(jié)

在這次的實(shí)踐中,發(fā)現(xiàn)了很多問(wèn)題,有的問(wèn)題還有待修復(fù),但是總體完成了。需要源原件的可以聯(lián)系博主。**文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-639657.html

到了這里,關(guān)于【spring】集成Web、druid、jdbcTemple實(shí)現(xiàn)免登錄時(shí)長(zhǎng)兩天半的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來(lái)自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • Spring Cloud Gateway集成Swagger實(shí)現(xiàn)微服務(wù)接口文檔統(tǒng)一管理及登錄訪問(wèn)

    Spring Cloud Gateway集成Swagger實(shí)現(xiàn)微服務(wù)接口文檔統(tǒng)一管理及登錄訪問(wèn)

    本文將介紹如何在 Spring Cloud 微服務(wù)中使用 Swagger 網(wǎng)關(guān)來(lái)統(tǒng)一管理所有微服務(wù)的接口文檔,并通過(guò) Spring Security 實(shí)現(xiàn)登錄后才能訪問(wèn) Swagger 文檔,以確保接口數(shù)據(jù)的安全訪問(wèn)。 在開(kāi)始之前,需要假設(shè)你已經(jīng)完成了 Spring Cloud Gateway 的相關(guān)配置,并且已經(jīng)了解了基本的網(wǎng)關(guān)配置知

    2024年02月05日
    瀏覽(38)
  • Spring Boot:Web應(yīng)用開(kāi)發(fā)之登錄與退出的實(shí)現(xiàn)

    Spring Boot:Web應(yīng)用開(kāi)發(fā)之登錄與退出的實(shí)現(xiàn)

    登錄與退出功能作為 Web 應(yīng)用中的基礎(chǔ)且重要的組成部分,直接關(guān)系到用戶的安全和隱私保護(hù)。通過(guò)實(shí)現(xiàn)登錄與退出功能,可以對(duì)用戶的身份進(jìn)行驗(yàn)證和授權(quán),確保只有合法的用戶才能訪問(wèn)特定的資源或執(zhí)行特定的操作。同時(shí),退出功能也為用戶提供了便捷的方式來(lái)結(jié)束當(dāng)前

    2024年04月23日
    瀏覽(21)
  • Spring Authorization Server入門(mén) (十三) 實(shí)現(xiàn)聯(lián)合身份認(rèn)證,集成Github與Gitee的OAuth登錄

    Spring Authorization Server入門(mén) (十三) 實(shí)現(xiàn)聯(lián)合身份認(rèn)證,集成Github與Gitee的OAuth登錄

    什么是聯(lián)合身份認(rèn)證? ??????通過(guò)Spring Security OAuth2 Client(Login)模塊集成第三方登錄至自己的認(rèn)證服務(wù)中,使用聯(lián)合身份認(rèn)證只需要請(qǐng)求認(rèn)證服務(wù),不通過(guò)前端來(lái)跳轉(zhuǎn)三方的授權(quán)申請(qǐng)鏈接,而是統(tǒng)一通過(guò)認(rèn)證服務(wù)來(lái)跳轉(zhuǎn),只需要維護(hù)Spring Authorization Server中身份認(rèn)證提供商

    2024年02月05日
    瀏覽(42)
  • Spring Boot + Druid 實(shí)現(xiàn)監(jiān)控 MySQL 性能,簡(jiǎn)單又實(shí)用!

    Spring Boot + Druid 實(shí)現(xiàn)監(jiān)控 MySQL 性能,簡(jiǎn)單又實(shí)用!

    來(lái)源:blog.csdn.net/lvoelife/article/details/128092586 我們都使用過(guò)連接池,比如 C3P0,DBCP,hikari, Druid ,雖然HikariCP的速度稍快,但Druid能夠提供強(qiáng)大的監(jiān)控和擴(kuò)展功能,也是阿里巴巴的開(kāi)源項(xiàng)目。 Druid是阿里巴巴開(kāi)發(fā)的號(hào)稱(chēng)為監(jiān)控而生的數(shù)據(jù)庫(kù)連接池,在功能、性能、擴(kuò)展性方面,

    2024年02月11日
    瀏覽(29)
  • SpringBoot項(xiàng)目集成Druid

    SpringBoot項(xiàng)目集成Druid

    本文將介紹Druid的相關(guān)內(nèi)容以及項(xiàng)目如何集成Druid,請(qǐng)多多指教。 Druid是阿里開(kāi)源的一個(gè)數(shù)據(jù)庫(kù)連接池的解決方案。它本身還自帶一個(gè)監(jiān)控平臺(tái),可以查看時(shí)時(shí)產(chǎn)生的sql、uri等監(jiān)控?cái)?shù)據(jù),可以排查慢sql、慢請(qǐng)求,方便對(duì)sql和項(xiàng)目代碼進(jìn)行調(diào)優(yōu)。 1.1數(shù)據(jù)庫(kù)連接池 數(shù)據(jù)庫(kù)連接池是

    2024年02月10日
    瀏覽(28)
  • Springboot集成 Druid

    Springboot集成 Druid

    Druid是一個(gè)開(kāi)源的數(shù)據(jù)庫(kù)連接池和SQL查詢優(yōu)化工具,用于提高應(yīng)用程序?qū)?shù)據(jù)庫(kù)的性能和可擴(kuò)展性。主要提供的功能:數(shù)據(jù)庫(kù)連接池、數(shù)據(jù)庫(kù)連接池監(jiān)控、SQL查詢優(yōu)化、數(shù)據(jù)源管理、防御SQL注入、統(tǒng)計(jì)和監(jiān)控。 注意:SpringBoot2.0默認(rèn)是用com.zaxxer.hikari.HikariDataSource作為數(shù)據(jù)源。

    2024年02月02日
    瀏覽(18)
  • Spring Boot整合Druid(druid 和 druid-spring-boot-starter)

    Spring Boot整合Druid(druid 和 druid-spring-boot-starter)

    引言 在現(xiàn)代的Web應(yīng)用開(kāi)發(fā)中,高性能的數(shù)據(jù)庫(kù)連接池是確保應(yīng)用穩(wěn)定性和響應(yīng)性的關(guān)鍵因素之一。Druid是一個(gè)開(kāi)源的高性能數(shù)據(jù)庫(kù)連接池,具有強(qiáng)大的監(jiān)控和統(tǒng)計(jì)功能,能夠在Spring Boot應(yīng)用中提供出色的數(shù)據(jù)庫(kù)連接管理。本文將研究在Spring Boot中集成Druid連接池的步驟,以及如

    2024年01月19日
    瀏覽(64)
  • 后端項(xiàng)目開(kāi)發(fā):集成Druid數(shù)據(jù)源

    Druid作為連接池中間件可以監(jiān)控?cái)?shù)據(jù)庫(kù)訪問(wèn)性能,對(duì)數(shù)據(jù)庫(kù)密碼加密,查看SQL執(zhí)行日志,擴(kuò)展JDBC。 添加依賴 參考官方文檔:https://github.com/alibaba/druid/wiki 更多配置參考:https://github.com/alibaba/druid/tree/master/druid-spring-boot-starter 啟動(dòng)應(yīng)用:訪問(wèn)http://localhost:8001/druid/login.html查看監(jiān)

    2024年02月11日
    瀏覽(20)
  • 若依微服務(wù)集成CAS,實(shí)現(xiàn)單點(diǎn)登錄

    若依(RuoYi)微服務(wù)是一款基于Spring Cloud Alibaba開(kāi)發(fā)的企業(yè)級(jí)微服務(wù)框架,采用前后端分離方式,使用了常用的微服務(wù)組件,如Feign、Nacos、Sentinel、Seata等,提供了豐富的微服務(wù)治理功能,如服務(wù)注冊(cè)、發(fā)現(xiàn)、路由、負(fù)載均衡、熔斷降級(jí)、限流等。借助若依微服務(wù)框架可以讓我

    2024年02月12日
    瀏覽(19)
  • Spring入門(mén)&控制反轉(zhuǎn)(或依賴注入)&AOP的關(guān)鍵概念& 多配置文件&與web集成

    目錄 1. 什么是spring,它能夠做什么? 2. 什么是控制反轉(zhuǎn)(或依賴注入) 3. AOP的關(guān)鍵概念 4. 示例 4.1 創(chuàng)建工程 4.2 pom文件 4.3 spring配置文件 4.4 示例代碼 4.4.1 示例1 4.4.2 示例2 (abstract,parent示例) 4.4.3 使用有參數(shù)構(gòu)造方法創(chuàng)建javaBean 4.4.4 init-method:指定bean的初始化方法 4.4.5 復(fù)雜屬

    2024年02月09日
    瀏覽(24)

覺(jué)得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包