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

SpringBoot整合SpringSecurity實現(xiàn)圖形驗證碼功能

 更新時間:2024年12月29日 14:45:55   作者:pan_junbiao  
圖形驗證碼是一種用于區(qū)分用戶是人類還是計算機程序的自動化測試,它通常用于防止自動化軟件進行惡意操作,如濫用在線服務(wù)、暴力破?解密碼或進行垃圾郵件發(fā)送等,下面將介紹?Spring?Boot?整合?Spring?Security?實現(xiàn)圖形驗證碼功能,需要的朋友可以參考下

1、圖形驗證碼的作用

圖形驗證碼(CAPTCHA,Completely Automated Public Turing test to tell Computers and Humans Apart)是一種用于區(qū)分用戶是人類還是計算機程序的自動化測試。它通常用于防止自動化軟件(如機器人或爬蟲程序)進行惡意操作,如濫用在線服務(wù)、暴力破 解密碼或進行垃圾郵件發(fā)送等。

圖形驗證碼的工作原理基于一個假設(shè):計算機程序難以自動識別和處理復(fù)雜的圖像或模式,而人類則相對容易。因此,圖形驗證碼通常包含扭曲的文字、數(shù)字、圖像或它們的組合,這些元素對人類來說相對容易辨認(rèn),但對計算機程序來說則非常困難。

下面將介紹 Spring Boot 整合 Spring Security 實現(xiàn)圖形驗證碼功能,執(zhí)行結(jié)果如下如:

(1)登錄頁面

(2)登錄成功后,跳轉(zhuǎn)至首頁

2、創(chuàng)建項目

【示例】SpringBoot 整合 SpringSecurity  使用過濾器實現(xiàn)圖形驗證碼功能。

2.1 創(chuàng)建 Spring Boot 項目

創(chuàng)建 SpringBoot 項目,項目結(jié)構(gòu)如下圖:

2.2 添加 Maven 依賴

在 pom.xml 配置文件中添加 Spring Security、谷歌 Kaptcha 圖形驗證碼。

<!-- Spring Security 依賴 -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-security</artifactId>
    <version>2.7.18</version>
</dependency>
 
<!-- 谷歌 Kaptcha 圖形驗證碼 -->
<dependency>
    <groupId>com.github.penggle</groupId>
    <artifactId>kaptcha</artifactId>
    <version>2.3.2</version>
</dependency>

3、整合 Spring Security 框架實現(xiàn)認(rèn)證與授權(quán)

3.1 配置類(Config 層)

創(chuàng)建 WebSecurityConfig 類(Spring Security 配置類),并添加 @EnableWebSecurity 注解和繼承 WebSecurityConfigurerAdapter 類。

package com.pjb.securitydemo.config;
 
import com.pjb.securitydemo.filter.VerificationCodeFilter;
import com.pjb.securitydemo.handler.LoginFailureHandler;
import com.pjb.securitydemo.handler.LoginSuccessHandler;
import com.pjb.securitydemo.handler.PermissionDeniedHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.password.NoOpPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
 
/**
 * Spring Security 配置類
 * @author pan_junbiao
 **/
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter
{
    @Autowired
    private LoginSuccessHandler loginSuccessHandler;
 
    @Autowired
    private LoginFailureHandler loginFailureHandler;
 
    @Autowired
    private PermissionDeniedHandler permissionDeniedHandler;
 
    @Override
    protected void configure(HttpSecurity http) throws Exception
    {
        http.authorizeRequests() //返回一個URL攔截注冊器
                .antMatchers("/captcha.jpg").permitAll() //公開其權(quán)限
                .anyRequest() //匹配所有的請求
                .authenticated() //所有匹配的URL都需要被認(rèn)證才能訪問
                .and() //結(jié)束當(dāng)前標(biāo)簽,讓上下文回到 HttpSecurity
                .formLogin() //啟動表單認(rèn)證
                .loginPage("/myLogin.html") //自定義登錄頁面
                .loginProcessingUrl("/auth/form") //指定處理登錄請求路徑
                .permitAll() //使登錄頁面不設(shè)限訪問
                //.defaultSuccessUrl("/index") //登錄認(rèn)證成功后的跳轉(zhuǎn)頁面
                .successHandler(loginSuccessHandler) //指定登錄成功時的處理
                .failureHandler(loginFailureHandler) //指定登錄失敗時的處理
                .and()
                .exceptionHandling().accessDeniedHandler(permissionDeniedHandler) //403無權(quán)時的返回操作
                .and().csrf().disable(); //關(guān)閉CSRF的防御功能
        
        //圖形驗證碼過濾器(核心代碼):將自定義過濾器添加在UsernamePasswordAuthenticationFilter之前
        http.addFilterBefore(new VerificationCodeFilter(), UsernamePasswordAuthenticationFilter.class);
    }
 
    /**
     * 內(nèi)存中添加登錄賬號
     */
    @Bean
    public UserDetailsService userDetailsService()
    {
        InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
        manager.createUser(User.withUsername("admin").password("123456").roles("ADMIN").build());
        manager.createUser(User.withUsername("user").password("123456").roles("USER").build());
        manager.createUser(User.withUsername("panjunbiao").password("123456").roles("USER").build());
        return manager;
    }
 
    /**
     * 密碼編譯器
     * 由于5.x版本之后默認(rèn)啟用了委派密碼編譯器,
     * 因而按照以往的方式設(shè)置內(nèi)存密碼將會讀取異常,
     * 所以需要暫時將密碼編碼器設(shè)置為 NoOpPasswordEncoder
     */
    @Bean
    public PasswordEncoder passwordEncoder()
    {
        return NoOpPasswordEncoder.getInstance();
    }
}

3.2 處理類(Handler 層)

(1)登錄成功處理類

package com.pjb.securitydemo.handler;
 
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import org.springframework.stereotype.Component;
 
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
 
/**
 * 登錄成功處理類
 */
@Component
public class LoginSuccessHandler implements AuthenticationSuccessHandler
{
    @Override
    public void onAuthenticationSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) throws IOException, ServletException
    {
        //重定向至首頁
        httpServletResponse.sendRedirect("/");
    }
}

(2)登錄失敗處理類

package com.pjb.securitydemo.handler;
 
import com.pjb.securitydemo.exception.VerificationCodeException;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.CredentialsExpiredException;
import org.springframework.security.authentication.DisabledException;
import org.springframework.security.authentication.LockedException;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.stereotype.Component;
 
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
 
/**
 * 登錄失敗處理類
 */
@Component
public class LoginFailureHandler implements AuthenticationFailureHandler
{
    @Override
    public void onAuthenticationFailure(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AuthenticationException authenticationException) throws IOException, ServletException
    {
        //獲取登錄失敗原因
        String errorMessage = "";
        if(authenticationException instanceof BadCredentialsException){
            errorMessage = "用戶名或密碼不正確";
        }else if(authenticationException instanceof DisabledException){
            errorMessage = "賬號被禁用";
        }else if(authenticationException instanceof UsernameNotFoundException){
            errorMessage = "用戶名不存在";
        }else if(authenticationException instanceof CredentialsExpiredException){
            errorMessage = "密碼已過期";
        }else if(authenticationException instanceof LockedException) {
            errorMessage = "賬號被鎖定";
        }else if(authenticationException instanceof VerificationCodeException){
            errorMessage = "無效的圖形驗證碼";
        }else{
            errorMessage = "未知異常";
        }
 
        //設(shè)置響應(yīng)編碼
        httpServletResponse.setContentType("application/json;charset=utf-8");
        PrintWriter out = httpServletResponse.getWriter();
        out.write(errorMessage);
    }
}

(3)403無權(quán)限處理類

package com.pjb.securitydemo.handler;
 
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.web.access.AccessDeniedHandler;
import org.springframework.stereotype.Component;
 
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
 
/**
 * 403無權(quán)限處理類
 */
@Component
public class PermissionDeniedHandler implements AccessDeniedHandler
{
    @Override
    public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AccessDeniedException e) throws IOException, ServletException
    {
        httpServletResponse.setContentType("application/json;charset=utf-8");
        PrintWriter out = httpServletResponse.getWriter();
        out.write("403無權(quán)限");
    }
}

4、整合 Kaptcha 框架實現(xiàn)圖形驗證碼

4.1 配置類(Config 層)

創(chuàng)建 KaptchaConfig 類(Kaptcha 圖形驗證碼配置類),設(shè)置圖形驗證碼相關(guān)屬性。

package com.pjb.securitydemo.config;
 
import com.google.code.kaptcha.Producer;
import com.google.code.kaptcha.impl.DefaultKaptcha;
import com.google.code.kaptcha.util.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
 
import java.util.Properties;
 
/**
 * 谷歌Kaptcha圖形驗證碼配置類
 */
@Configuration
public class KaptchaConfig
{
    @Bean
    public Producer captcha()
    {
        //配置圖形驗證碼的基本參數(shù)
        Properties properties = new Properties();
        //圖片寬度
        properties.setProperty("kaptcha.image.width","150");
        //圖片長度
        properties.setProperty("kaptcha.image.height","50");
        //字符集(從哪些字符中產(chǎn)生)
        properties.setProperty("kaptcha.textproducer.char.string", "0123456789");
        //字符長度
        properties.setProperty("kaptcha.textproducer.char.length", "4");
        //字體顏色
        properties.put("kaptcha.textproducer.font.color", "red");
        // 文字間隔,這里設(shè)置為10px
        properties.put("kaptcha.textproducer.char.space", "10");
 
        // 背景顏色漸變開始
        properties.put("kaptcha.background.clear.from", "yellow");
        // 背景顏色漸變結(jié)束
        properties.put("kaptcha.background.clear.to", "green");
 
        //初始化配置
        Config config = new Config(properties);
 
        //使用默認(rèn)的圖形驗證碼實現(xiàn),當(dāng)然也可以自定義實現(xiàn)
        DefaultKaptcha defaultKaptcha = new DefaultKaptcha();
        defaultKaptcha.setConfig(config);
        return defaultKaptcha;
    }
}

圖形驗證碼配置屬性表

屬性名屬性作用默認(rèn)值
kaptcha.border圖片邊框,合法值:yes , noyes
kaptcha.border.color邊框顏色,合法值: r,g,b (and optional alpha) 或者 white,black,blue.black
kaptcha.image.width圖片寬200
kaptcha.image.height圖片高50
kaptcha.producer.impl圖片實現(xiàn)類com.google.code.kaptcha.impl.DefaultKaptcha
kaptcha.textproducer.impl文本實現(xiàn)類com.google.code.kaptcha.text.impl.DefaultTextCreator
kaptcha.textproducer.char.string文本集合,驗證碼值從此集合中獲取abcde2345678gfynmnpwx
kaptcha.textproducer.char.length驗證碼長度5
kaptcha.textproducer.font.names字體Arial, Courier
kaptcha.textproducer.font.size字體大小40px.
kaptcha.textproducer.font.color字體顏色,合法值: r,g,b 或者 white,black,blue.black
kaptcha.textproducer.char.space文字間隔2
kaptcha.noise.impl干擾實現(xiàn)類com.google.code.kaptcha.impl.DefaultNoise
kaptcha.noise.color干擾 顏色,合法值: r,g,b 或者 white,black,blue.black
kaptcha.obscurificator.impl

圖片樣式:<br />水紋 com.google.code.kaptcha.impl.WaterRipple <br />

魚眼 com.google.code.kaptcha.impl.FishEyeGimpy <br />

陰影 com.google.code.kaptcha.impl.ShadowGimpy

com.google.code.kaptcha.impl.WaterRipple
kaptcha.background.impl背景實現(xiàn)類com.google.code.kaptcha.impl.DefaultBackground
kaptcha.background.clear.from背景顏色漸變,開始顏色light grey
kaptcha.background.clear.to背景顏色漸變, 結(jié)束顏色white
kaptcha.word.impl文字渲染器com.google.code.kaptcha.text.impl.DefaultWordRenderer
kaptcha.session.keysession keyKAPTCHA_SESSION_KEY
kaptcha.session.datesession date

4.2 控制器層(Controller 層)

創(chuàng)建 CaptchaController 類(驗證碼控制器),實現(xiàn)生成驗證碼圖片方法。

package com.pjb.securitydemo.controller;
 
import com.google.code.kaptcha.Producer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
 
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.IOException;
 
/**
 * 驗證碼控制器
 */
@Controller
public class CaptchaController
{
    @Autowired
    private Producer captchaProducer;
 
    @GetMapping("/captcha.jpg")
    public void getCaptcha(HttpServletRequest request, HttpServletResponse response) throws IOException
    {
        //設(shè)置內(nèi)容類型
        response.setContentType("image/jpeg");
        //創(chuàng)建驗證碼文本
        String capText = captchaProducer.createText();
 
        //將驗證碼文本保存到Session中
        request.getSession().setAttribute("captcha", capText);
        //創(chuàng)建驗證碼圖片
        BufferedImage bufferedImage = captchaProducer.createImage(capText);
        //獲取響應(yīng)輸出流
        ServletOutputStream out = response.getOutputStream();
        //將圖片驗證碼數(shù)據(jù)寫入響應(yīng)輸出流
        ImageIO.write(bufferedImage,"jpg",out);
        //推送并關(guān)閉響應(yīng)輸出流
        try
        {
            out.flush();
        }
        finally
        {
            out.close();
        }
    }
}

4.3 自定義異常類(Exception 層)

自定義異常類 VerificationCodeException(驗證碼校驗失敗的異常類),繼承 AuthenticationException 類。

package com.pjb.securitydemo.exception;
 
import org.springframework.security.core.AuthenticationException;
 
/**
 * 驗證碼校驗失敗的異常類
 */
public class VerificationCodeException extends AuthenticationException
{
    public VerificationCodeException()
    {
        super("圖形驗證碼校驗失敗");
    }
}

4.4 自定義過濾器(Filter 層)

自定義過濾器類 VerificationCodeFilter (驗證碼校驗過濾器),繼承 OncePerRequestFilter 類。

有了圖形驗證碼的 API 之后,就可以自定義驗證碼校驗過濾器了。雖然 Spring Security 的過濾器鏈對過濾器沒有特殊要求,只要繼承 Filter 接口即可,但是在 Spring 體系中,推薦使用  OncePerRequestFilter 類來實現(xiàn),它可以確保一次請求只會通過一次該過濾器(Filter 實際上并不能保證這一點)。

package com.pjb.securitydemo.filter;
 
import com.pjb.securitydemo.exception.VerificationCodeException;
import com.pjb.securitydemo.handler.LoginFailureHandler;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.util.StringUtils;
import org.springframework.web.filter.OncePerRequestFilter;
 
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
 
/**
 * 驗證碼校驗過濾器
 */
public class VerificationCodeFilter extends OncePerRequestFilter
{
    private AuthenticationFailureHandler authenticationFailureHandler = new LoginFailureHandler();
 
    @Override
    protected void doFilterInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, FilterChain filterChain) throws ServletException, IOException
    {
        //非登錄請求不校驗驗證碼
        String requestURI = httpServletRequest.getRequestURI();
        if(!"/auth/form".equals(requestURI))
        {
            filterChain.doFilter(httpServletRequest,httpServletResponse);
        }
        else
        {
            try
            {
                //驗證碼校驗
                verificationCode(httpServletRequest);
 
                //驗證成功
                filterChain.doFilter(httpServletRequest,httpServletResponse);
            }
            catch (VerificationCodeException ex)
            {
                //驗證失敗
                authenticationFailureHandler.onAuthenticationFailure(httpServletRequest, httpServletResponse, ex);
            }
        }
    }
 
    /**
     * 驗證碼校驗
     */
    public void verificationCode(HttpServletRequest httpServletRequest) throws VerificationCodeException
    {
        String requestCode = httpServletRequest.getParameter("captcha");
        HttpSession session = httpServletRequest.getSession();
        String savedCode = (String)session.getAttribute("captcha");
        if(!StringUtils.isEmpty(savedCode))
        {
            //隨手清除驗證碼,無論是失敗,還是成功。客戶端應(yīng)在登錄失敗時刷新驗證碼
            session.removeAttribute("captcha");
        }
 
        //驗證不通過,拋出異常
        if(StringUtils.isEmpty(requestCode) || StringUtils.isEmpty(savedCode) || !requestCode.equals(savedCode))
        {
            throw new VerificationCodeException();
        }
    }
}

至此整合 Kaptcha 框架實現(xiàn)圖形驗證碼已完成,最后注意,一定要把自定義過濾器類 VerificationCodeFilter 添加到 Spring Security 的過濾器鏈中。

打開 WebSecurityConfig 類(Spring Security 配置類),將自定義過濾器類 VerificationCodeFilter 添加到過濾器鏈中,如下:

5、前端頁面

5.1 控制器層(Controller 層)

創(chuàng)建 IndexController 類(首頁控制器),實現(xiàn)獲取當(dāng)前登錄用戶名并跳轉(zhuǎn)至首頁。

package com.pjb.securitydemo.controller;
 
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
 
import javax.servlet.http.HttpServletRequest;
import java.security.Principal;
 
/**
 * 首頁控制器
 * @author pan_junbiao
 **/
@Controller
public class IndexController
{
    /**
     * 首頁
     */
    @RequestMapping("/")
    public String index(HttpServletRequest request)
    {
        //獲取當(dāng)前登錄人
        String userName = "未登錄";
        Principal principal = request.getUserPrincipal();
        if(principal!=null)
        {
            userName = principal.getName();
        }
 
        //返回頁面
        request.setAttribute("userName",userName);
        return "/index.html";
    }
 
}

5.2 編寫登錄頁面

在 resources\static 靜態(tài)資源目錄下,創(chuàng)建 myLogin.html 頁面。

注意:myLogin.html 頁面必須放在 resources\static 靜態(tài)資源目錄下,否則頁面無法加載。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登錄</title>
    <meta name="author" content="pan_junbiao的博客">
</head>
<body>
<form name="myForm" action="/auth/form" method="post">
    <table align="center">
        <caption>用戶登錄</caption>
        <tr>
            <td>登錄賬戶:</td>
            <td>
                <input type="text" name="username" placeholder="請輸入登錄賬戶" value="panjunbiao" />
            </td>
        </tr>
        <tr>
            <td>登錄密碼:</td>
            <td>
                <input type="password" name="password" placeholder="請輸入登錄密碼" value="123456" />
            </td>
        </tr>
        <tr>
            <td>驗證碼:</td>
            <td>
                <!-- 新增圖形驗證碼的輸入框 -->
                <input type="text" name="captcha" placeholder="請輸入驗證碼" />
 
                <!-- 圖片指向圖形驗證碼API -->
                <img src="/captcha.jpg" alt="captch" height="50px" width="150px" style="margin-left:20px;" >
            </td>
        </tr>
        <!-- 以下是提交、取消按鈕 -->
        <tr>
            <td colspan="2" style="text-align: center; padding: 5px;">
                <input type="submit" value="提交" />
                <input type="reset" value="重置" />
            </td>
        </tr>
    </table>
</form>
</body>
</html>

5.3 編寫首頁

在 resources\templates 資源目錄下,創(chuàng)建 index.html 頁面。

注意:首頁 index.html 頁面中使用 Thymeleaf 模板 。

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>首頁</title>
    <meta name="author" content="pan_junbiao的博客">
</head>
<body>
    <h1 style="color: red">Hello,Spring Security</h1>
    <p>博客信息:您好,歡迎訪問 pan_junbiao的博客</p>
    <p>博客地址:https://blog.csdn.net/pan_junbiao</p>
    <p th:text="'當(dāng)前登錄人:' + ${userName}"></p>
    <a href="/logout" rel="external nofollow"  onclick="return confirm('確認(rèn)注銷嗎?');">登出</a>
</body>
</html>

6、運行項目

6.1 登錄頁面

6.2 圖形驗證碼校驗失敗

6.3 登錄成功后,跳轉(zhuǎn)至首頁

以上就是SpringBoot整合SpringSecurity實現(xiàn)圖形驗證碼功能的詳細內(nèi)容,更多關(guān)于SpringBoot SpringSecurity圖形驗證碼的資料請關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

  • 劍指Offer之Java算法習(xí)題精講N叉樹的遍歷及數(shù)組與字符串

    劍指Offer之Java算法習(xí)題精講N叉樹的遍歷及數(shù)組與字符串

    跟著思路走,之后從簡單題入手,反復(fù)去看,做過之后可能會忘記,之后再做一次,記不住就反復(fù)做,反復(fù)尋求思路和規(guī)律,慢慢積累就會發(fā)現(xiàn)質(zhì)的變化
    2022-03-03
  • java 中平方根(sqrt)算法 的實例詳解

    java 中平方根(sqrt)算法 的實例詳解

    這篇文章主要介紹了java 中平方根(sqrt)算法 的實例詳解的相關(guān)資料,需要的朋友可以參考下
    2017-04-04
  • 一篇文章帶你從java字節(jié)碼層理解i++和++i

    一篇文章帶你從java字節(jié)碼層理解i++和++i

    這篇文章帶你從java字節(jié)碼層理解i++和++i,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-09-09
  • Mybatis的if從句中的賦值烏龍

    Mybatis的if從句中的賦值烏龍

    本文主要介紹了Mybatis的if從句中的賦值烏龍,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2025-05-05
  • Java實戰(zhàn)之網(wǎng)上書店管理系統(tǒng)的實現(xiàn)

    Java實戰(zhàn)之網(wǎng)上書店管理系統(tǒng)的實現(xiàn)

    本文將利用Java語言實現(xiàn)網(wǎng)上書店管理系統(tǒng)。其功能一般包括:圖書信息管理、用戶信息管理、圖書購買、圖書訂單查看、圖書添加、圖書維護等等,感興趣的可以了解一下
    2022-06-06
  • SpringBoot中ClientAbortException: Broken pipe異常解決及優(yōu)化方案

    SpringBoot中ClientAbortException: Broken pipe異常解決及優(yōu)

    這篇文章主要介紹了如何解決 Spring Boot 中的 ClientAbortException: Broken pipe 異常及優(yōu)化方案,異常發(fā)生在 Spring Boot 項目中,表示客戶端與服務(wù)端的 HTTP 請求連接被中斷,接下來由小編給大家介紹一下出現(xiàn)這個問題的原因,需要的朋友可以參考下
    2024-12-12
  • spring?Bean創(chuàng)建的完整過程記錄

    spring?Bean創(chuàng)建的完整過程記錄

    這篇文章主要給大家介紹了關(guān)于Spring中Bean實例創(chuàng)建的相關(guān)資料,文中通過實例代碼和圖文介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下
    2022-01-01
  • Spring項目中使用Cache?Redis實現(xiàn)數(shù)據(jù)緩存

    Spring項目中使用Cache?Redis實現(xiàn)數(shù)據(jù)緩存

    這篇文章主要為大家介紹了項目中使用Spring?Cache?Redis實現(xiàn)數(shù)據(jù)緩存,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪
    2022-06-06
  • Java 基礎(chǔ)語法讓你弄懂類和對象

    Java 基礎(chǔ)語法讓你弄懂類和對象

    C 語言是面向過程的,而 Java 是面向?qū)ο笫俏覀兂B牭降囊痪湓?,這章將帶你揭曉Java 基礎(chǔ)語法中類與對象到底是什么,需要的朋友請參考下文
    2021-08-08
  • java:程序包javax.servlet.http不存在問題解決

    java:程序包javax.servlet.http不存在問題解決

    這篇文章主要給大家介紹了關(guān)于java:程序包javax.servlet.http不存在問題解決的相關(guān)資料,如果引用的包依賴的庫文件缺失或版本不匹配,就會導(dǎo)致"Java 程序包不存在"的錯誤,需要的朋友可以參考下
    2023-10-10

最新評論

循化| 玉环县| 梁平县| 平定县| 长丰县| 兴安县| 郯城县| 星子县| 甘南县| 类乌齐县| 桂阳县| 旅游| 阿拉善右旗| 奉节县| 武隆县| 绥宁县| 海安县| 孝义市| 砚山县| 寻乌县| 新和县| 望谟县| 京山县| 顺平县| 蕉岭县| 抚松县| 五指山市| 丹寨县| 达孜县| 呼伦贝尔市| 奉贤区| 石阡县| 萍乡市| 孟村| 钟祥市| 建水县| 怀来县| 张家港市| 黄大仙区| 沅陵县| 沐川县|