基于springboot实现多线程抢锁的demo

这篇具有很好参考价值的文章主要介绍了基于springboot实现多线程抢锁的demo。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

1、本代码基于定时调度和异步执行同时处理,如果只加异步处理,会导致当前任务未执行完,下个任务到点也不会触发执行

    @Scheduled(fixedRate = 50_000)
    @Async
    public void testThread() throws Exception{

        ZkLock lock = new ZkLock(zkJob.getZK(), "/vman/analyse_job/lock2");
        try {
            if (!lock.acquire(20, TimeUnit.SECONDS)) {
                log.warn("有其他线程进行分析任务的数据迁移,暂停本次执行");
                return;
            }
            StringBuilder sb = new StringBuilder("处理成功的分析任务id:");
            Integer startShareId = 1;
            Integer endShareId   = 100;
            Integer count = 0;

            while (startShareId.compareTo(endShareId) <= 0) {
                try {

                    Thread.sleep(1000);
                    sb.append(startShareId).append(",");
                } catch (Exception e) {
                    log.info("自助分析任务批量转换异常,jobId:{},exception:{}", startShareId, e);
                }
                startShareId++;

                if (count++ % 20 == 0) {
                    log.info("当前分析任务id:{},转换成功的任务信息:{}", startShareId, sb.toString());
                    sb = new StringBuilder("处理成功的分析任务id:");
                }
            }
        }catch(Exception e) {
            log.info("定时任务,分析任务转换异常:{}",e);
        }finally {
            log.info("关闭分析任务的锁");
            lock.release();
        }
    }

2、日志信息:

[2023-09-04 18:54:15.562] [INFO] [SimpleAsyncTaskExecutor-64] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:62,转换成功的任务信息:处理成功的分析任务id:42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,
[2023-09-04 18:54:23.082] [WARN] [SimpleAsyncTaskExecutor-65] [com.vip.vman.service.job.VmanConvertManager] >>> 有其他线程进行分析任务的数据迁移,暂停本次执行
[2023-09-04 18:54:23.083] [INFO] [SimpleAsyncTaskExecutor-65] [com.vip.vman.service.job.VmanConvertManager] >>> 关闭分析任务的锁
[2023-09-04 18:54:35.629] [INFO] [SimpleAsyncTaskExecutor-64] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:82,转换成功的任务信息:处理成功的分析任务id:62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,
[2023-09-04 18:54:41.870] [INFO] [client-forward-message-scheduler] [com.vip.daas.client.DaasSession$DaasClientEndpoint] >>> Send heart beat message to master [10.199.210.210:9002]
[2023-09-04 18:54:54.687] [INFO] [SimpleAsyncTaskExecutor-64] [com.vip.vman.service.job.VmanConvertManager] >>> 关闭分析任务的锁
[2023-09-04 18:54:54.687] [INFO] [SimpleAsyncTaskExecutor-64] [com.vip.vman.client.zk.ZkLock] >>> zkLock release -> /vman/analyse_job/2023090418/lock2
[2023-09-04 18:54:55.852] [INFO] [SimpleAsyncTaskExecutor-66] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:2,转换成功的任务信息:处理成功的分析任务id:1,
[2023-09-04 18:55:15.934] [INFO] [SimpleAsyncTaskExecutor-66] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:22,转换成功的任务信息:处理成功的分析任务id:2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,
[2023-09-04 18:55:36.024] [INFO] [SimpleAsyncTaskExecutor-66] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:42,转换成功的任务信息:处理成功的分析任务id:22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,
[2023-09-04 18:55:41.866] [INFO] [client-forward-message-scheduler] [com.vip.daas.client.DaasSession$DaasClientEndpoint] >>> Send heart beat message to master [10.199.210.210:9002]
[2023-09-04 18:55:56.091] [INFO] [SimpleAsyncTaskExecutor-66] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:62,转换成功的任务信息:处理成功的分析任务id:42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,
[2023-09-04 18:56:03.061] [WARN] [SimpleAsyncTaskExecutor-67] [com.vip.vman.service.job.VmanConvertManager] >>> 有其他线程进行分析任务的数据迁移,暂停本次执行
[2023-09-04 18:56:03.061] [INFO] [SimpleAsyncTaskExecutor-67] [com.vip.vman.service.job.VmanConvertManager] >>> 关闭分析任务的锁
[2023-09-04 18:56:16.164] [INFO] [SimpleAsyncTaskExecutor-66] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:82,转换成功的任务信息:处理成功的分析任务id:62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,
[2023-09-04 18:56:35.223] [INFO] [SimpleAsyncTaskExecutor-66] [com.vip.vman.service.job.VmanConvertManager] >>> 关闭分析任务的锁
[2023-09-04 18:56:35.223] [INFO] [SimpleAsyncTaskExecutor-66] [com.vip.vman.client.zk.ZkLock] >>> zkLock release -> /vman/analyse_job/2023090418/lock2
[2023-09-04 18:56:36.359] [INFO] [SimpleAsyncTaskExecutor-68] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:2,转换成功的任务信息:处理成功的分析任务id:1,
[2023-09-04 18:56:41.876] [INFO] [client-forward-message-scheduler] [com.vip.daas.client.DaasSession$DaasClientEndpoint] >>> Send heart beat message to master [10.199.210.210:9002]
[2023-09-04 18:56:56.429] [INFO] [SimpleAsyncTaskExecutor-68] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:22,转换成功的任务信息:处理成功的分析任务id:2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,
[2023-09-04 18:57:16.497] [INFO] [SimpleAsyncTaskExecutor-68] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:42,转换成功的任务信息:处理成功的分析任务id:22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,
[2023-09-04 18:57:36.600] [INFO] [SimpleAsyncTaskExecutor-68] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:62,转换成功的任务信息:处理成功的分析任务id:42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,
[2023-09-04 18:57:41.895] [INFO] [client-forward-message-scheduler] [com.vip.daas.client.DaasSession$DaasClientEndpoint] >>> Send heart beat message to master [10.199.210.210:9002]
[2023-09-04 18:57:43.098] [WARN] [SimpleAsyncTaskExecutor-69] [com.vip.vman.service.job.VmanConvertManager] >>> 有其他线程进行分析任务的数据迁移,暂停本次执行
[2023-09-04 18:57:43.099] [INFO] [SimpleAsyncTaskExecutor-69] [com.vip.vman.service.job.VmanConvertManager] >>> 关闭分析任务的锁
[2023-09-04 18:57:56.675] [INFO] [SimpleAsyncTaskExecutor-68] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:82,转换成功的任务信息:处理成功的分析任务id:62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,
[2023-09-04 18:58:15.756] [INFO] [SimpleAsyncTaskExecutor-68] [com.vip.vman.service.job.VmanConvertManager] >>> 关闭分析任务的锁
[2023-09-04 18:58:15.757] [INFO] [SimpleAsyncTaskExecutor-68] [com.vip.vman.client.zk.ZkLock] >>> zkLock release -> /vman/analyse_job/2023090418/lock2
[2023-09-04 18:58:16.890] [INFO] [SimpleAsyncTaskExecutor-70] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:2,转换成功的任务信息:处理成功的分析任务id:1,
[2023-09-04 18:58:36.962] [INFO] [SimpleAsyncTaskExecutor-70] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:22,转换成功的任务信息:处理成功的分析任务id:2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,
[2023-09-04 18:58:41.901] [INFO] [client-forward-message-scheduler] [com.vip.daas.client.DaasSession$DaasClientEndpoint] >>> Send heart beat message to master [10.199.210.210:9002]
[2023-09-04 18:58:57.032] [INFO] [SimpleAsyncTaskExecutor-70] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:42,转换成功的任务信息:处理成功的分析任务id:22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,
[2023-09-04 18:59:17.101] [INFO] [SimpleAsyncTaskExecutor-70] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:62,转换成功的任务信息:处理成功的分析任务id:42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,
[2023-09-04 18:59:23.117] [WARN] [SimpleAsyncTaskExecutor-71] [com.vip.vman.service.job.VmanConvertManager] >>> 有其他线程进行分析任务的数据迁移,暂停本次执行
[2023-09-04 18:59:23.117] [INFO] [SimpleAsyncTaskExecutor-71] [com.vip.vman.service.job.VmanConvertManager] >>> 关闭分析任务的锁
[2023-09-04 18:59:37.173] [INFO] [SimpleAsyncTaskExecutor-70] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:82,转换成功的任务信息:处理成功的分析任务id:62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,
[2023-09-04 18:59:41.897] [INFO] [client-forward-message-scheduler] [com.vip.daas.client.DaasSession$DaasClientEndpoint] >>> Send heart beat message to master [10.199.210.210:9002]

3、使用 jstack 88023 |grep SimpleAsyncTaskExecutor-62 命令可以查看相关线程是否存在,可以看到,相关线程任务执行完成后,会自动消失

4、如果去掉异步,代码如下

 //@Async
    @Scheduled(fixedRate = 30_000)
    public void testThread() throws Exception{

        ZkLock lock = new ZkLock(zkJob.getZK(), "/vman/analyse_job/lock2");
        try {
            if (!lock.acquire(20, TimeUnit.SECONDS)) {
                log.warn("有其他线程进行分析任务的数据迁移,暂停本次执行");
                return;
            }
            StringBuilder sb = new StringBuilder("处理成功的分析任务id:");
            Integer startShareId = 1;
            Integer endShareId   = 60;
            Integer count = 0;

            while (startShareId.compareTo(endShareId) <= 0) {
                try {

                    Thread.sleep(1000);
                    sb.append(startShareId).append(",");
                } catch (Exception e) {
                    log.info("自助分析任务批量转换异常,jobId:{},exception:{}", startShareId, e);
                }
                startShareId++;

                if (count++ % 20 == 0) {
                    log.info("当前分析任务id:{},转换成功的任务信息:{}", startShareId, sb.toString());
                    sb = new StringBuilder("处理成功的分析任务id:");
                }
            }
        }catch(Exception e) {
            log.info("定时任务,分析任务转换异常:{}",e);
        }finally {
            log.info("关闭分析任务的锁");
            lock.release();
        }
    }

发现任务执行的线程只有一个 叫 scheduling-1文章来源地址https://www.toymoban.com/news/detail-700638.html

[2023-09-04 19:52:57.765] [WARN] [scheduling-1] [org.apache.curator.utils.ZKPaths] >>> The version of ZooKeeper being used doesn't support Container nodes. CreateMode.PERSISTENT will be used instead.
[2023-09-04 19:52:59.394] [INFO] [scheduling-1] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:2,转换成功的任务信息:处理成功的分析任务id:1,
[2023-09-04 19:53:19.465] [INFO] [scheduling-1] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:22,转换成功的任务信息:处理成功的分析任务id:2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,
[2023-09-04 19:53:39.533] [INFO] [scheduling-1] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:42,转换成功的任务信息:处理成功的分析任务id:22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,
[2023-09-04 19:53:41.406] [INFO] [client-forward-message-scheduler] [com.vip.daas.client.DaasSession$DaasClientEndpoint] >>> Send heart beat message to master [10.199.210.210:9002]
[2023-09-04 19:53:58.616] [INFO] [scheduling-1] [com.vip.vman.service.job.VmanConvertManager] >>> 关闭分析任务的锁
[2023-09-04 19:53:58.620] [INFO] [scheduling-1] [com.vip.vman.client.zk.ZkLock] >>> zkLock release -> /vman/analyse_job/2023090419/lock2
[2023-09-04 19:53:59.880] [INFO] [scheduling-1] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:2,转换成功的任务信息:处理成功的分析任务id:1,
[2023-09-04 19:54:19.959] [INFO] [scheduling-1] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:22,转换成功的任务信息:处理成功的分析任务id:2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,
[2023-09-04 19:54:40.043] [INFO] [scheduling-1] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:42,转换成功的任务信息:处理成功的分析任务id:22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,
[2023-09-04 19:54:41.405] [INFO] [client-forward-message-scheduler] [com.vip.daas.client.DaasSession$DaasClientEndpoint] >>> Send heart beat message to master [10.199.210.210:9002]
[2023-09-04 19:54:59.158] [INFO] [scheduling-1] [com.vip.vman.service.job.VmanConvertManager] >>> 关闭分析任务的锁
[2023-09-04 19:54:59.160] [INFO] [scheduling-1] [com.vip.vman.client.zk.ZkLock] >>> zkLock release -> /vman/analyse_job/2023090419/lock2
[2023-09-04 19:54:59.384] [WARN] [Thread-51] [org.apache.curator.framework.recipes.locks.InterProcessSemaphoreV2] >>> Lease already released
org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /vma.vip.vip.com/vman/analyse_job/2023090419/lock2/leases/_c_2f05745b-600d-4d3c-aa61-eb518072383a-lease-0000000001
	at org.apache.zookeeper.KeeperException.create(KeeperException.java:111)
	at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
	at org.apache.zookeeper.ZooKeeper.delete(ZooKeeper.java:873)
	at org.apache.curator.framework.imps.DeleteBuilderImpl$5.call(DeleteBuilderImpl.java:250)
	at org.apache.curator.framework.imps.DeleteBuilderImpl$5.call(DeleteBuilderImpl.java:244)
	at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:109)
	at org.apache.curator.framework.imps.DeleteBuilderImpl.pathInForeground(DeleteBuilderImpl.java:241)
	at org.apache.curator.framework.imps.DeleteBuilderImpl.forPath(DeleteBuilderImpl.java:225)
	at org.apache.curator.framework.imps.DeleteBuilderImpl.forPath(DeleteBuilderImpl.java:35)
	at org.apache.curator.framework.recipes.locks.InterProcessSemaphoreV2$3.close(InterProcessSemaphoreV2.java:437)
	at org.apache.curator.framework.recipes.locks.InterProcessSemaphoreMutex.release(InterProcessSemaphoreMutex.java:67)
	at com.vip.vman.client.zk.ZkLock$1.run(ZkLock.java:59)
	at java.lang.Thread.run(Thread.java:750)
[2023-09-04 19:54:59.426] [ERROR] [Thread-51] [com.vip.vman.client.zk.ZK] >>> 
org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /vma.vip.vip.com/vman/analyse_job/2023090419/lock2/leases
	at org.apache.zookeeper.KeeperException.create(KeeperException.java:111)
	at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
	at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1650)
	at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:230)
	at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:219)
	at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:109)
	at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:216)
	at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:207)
	at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:40)
	at com.vip.vman.client.zk.ZK.getChildrenNum(ZK.java:408)
	at com.vip.vman.client.zk.ZkLock$1.run(ZkLock.java:61)
	at java.lang.Thread.run(Thread.java:750)
[2023-09-04 19:54:59.431] [ERROR] [Thread-51] [com.vip.vman.client.zk.ZkLock] >>> 
java.lang.NullPointerException
	at com.vip.vman.client.zk.ZkLock$1.run(ZkLock.java:61)
	at java.lang.Thread.run(Thread.java:750)
[2023-09-04 19:55:01.197] [INFO] [scheduling-1] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:2,转换成功的任务信息:处理成功的分析任务id:1,
[2023-09-04 19:55:21.280] [INFO] [scheduling-1] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:22,转换成功的任务信息:处理成功的分析任务id:2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,
[2023-09-04 19:55:41.354] [INFO] [scheduling-1] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:42,转换成功的任务信息:处理成功的分析任务id:22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,
[2023-09-04 19:55:41.400] [INFO] [client-forward-message-scheduler] [com.vip.daas.client.DaasSession$DaasClientEndpoint] >>> Send heart beat message to master [10.199.210.210:9002]
[2023-09-04 19:56:00.429] [INFO] [scheduling-1] [com.vip.vman.service.job.VmanConvertManager] >>> 关闭分析任务的锁
[2023-09-04 19:56:00.430] [INFO] [scheduling-1] [com.vip.vman.client.zk.ZkLock] >>> zkLock release -> /vman/analyse_job/2023090419/lock2
[2023-09-04 19:56:01.644] [INFO] [scheduling-1] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:2,转换成功的任务信息:处理成功的分析任务id:1,
[2023-09-04 19:56:21.693] [INFO] [scheduling-1] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:22,转换成功的任务信息:处理成功的分析任务id:2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,
[2023-09-04 19:56:41.403] [INFO] [client-forward-message-scheduler] [com.vip.daas.client.DaasSession$DaasClientEndpoint] >>> Send heart beat message to master [10.199.210.210:9002]
[2023-09-04 19:56:41.774] [INFO] [scheduling-1] [com.vip.vman.service.job.VmanConvertManager] >>> 当前分析任务id:42,转换成功的任务信息:处理成功的分析任务id:22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,

到了这里,关于基于springboot实现多线程抢锁的demo的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 基于Spring注解 + MyBatis + Servlet 实现数据库交换的小小Demo

    配置数据库连接信息 db.properties 配置web.xml 配置logback.xml配置文件 配置applicationContext.xml 里面的bean 配置myBatis核心配置文件mybatis-config.xml 创建实体类对象User 创建LoginServlet响应前端的数据 创建UserService 接口 创建UserMapper接口 创建UserServiceImpl 接口实现类 按照这样的方式进行拼接

    2024年02月02日
    浏览(81)
  • 【Spring Boot】SpringBoot参数验证以及实现原理

    参数验证很重要,是平时开发环节中不可少的一部分,但是我想很多后端同事会偷懒,干脆不做,这样很可能给系统的稳定性和安全性带来严重的危害。 那么在Spring Boot应用中如何做好参数校验工作呢,本文提供了小技巧以及验证实现原理,你知道几个呢? Spring Boot 提供了内

    2023年04月16日
    浏览(52)
  • 【Spring Boot】SpringBoot完整实现社交网站系统

    一个完整的社交网站系统需要涉及到用户登录、发布动态、关注、评论、私信等各方面。这里提供一个简单的实现示例,供参考。 前端代码 前端使用Vue框架,以下是部分代码示例: 登录页: 首页: 后端代码 后端使用Spring Boot框架,以下是部分代码示例: 登录Controller: U

    2024年02月11日
    浏览(39)
  • 毕业设计springboot基于spring boot的在线答题微信小程序

    :在线答题微信小程序;JAVA语言;MySQL数据库; Abstract WeChat widget for online question answering is an important part of the exam. Online question answering is the main channel for students to obtain task information. In order to facilitate students to view task information and exams on the website, a simple and portable online W

    2024年04月26日
    浏览(50)
  • Spring Boot集成WebSocket Demo,简单明了

    如果是初次搭建Spring Boot+WebSocket项目,不需要太复杂,只需要快速上手,那么你搜到的大部分文章可能都不适合你,我的这篇文章以最精简的方式搭建一个可以运行并通信的Spring Boot+WebSocket的Demo项目,有了根基之后再进行复杂化就不是难事了。 搭建Spring Boot项目都会吧,下面

    2024年02月09日
    浏览(37)
  • Spring Boot集成Graphql快速入门Demo

    GraphQL 是一个用于 API 的查询语言,是一个使用基于类型系统来执行查询的服务端运行时(类型系统由你的数据定义)。GraphQL 并没有和任何特定数据库或者存储引擎绑定,而是依靠你现有的代码和数据支撑。 优势 GraphQL 速度快,并且比较稳定,GraphQL 的操作是在数据层面的,

    2024年04月13日
    浏览(42)
  • 【Spring boot实战】Springboot+对话ai模型整体框架+高并发线程机制处理优化+提示词工程效果展示(按照框架自己修改可对接市面上百分之99的模型)

     🎉🎉欢迎光临🎉🎉 🏅我是苏泽,一位对技术充满热情的探索者和分享者。🚀🚀 🌟特别推荐给大家我的最新专栏 《Spring 狂野之旅:底层原理高级进阶》 🚀 本专栏纯属为爱发电永久免费!!! 这是苏泽的个人主页可以看到我其他的内容哦👇👇 努力的苏泽 http://suze

    2024年02月19日
    浏览(45)
  • SpringBoot+jasypt-spring-boot-starter实现配置文件明文加密

    springboot:2.1.4.RELEASE JDK:8 jasypt-spring-boot-starter:3.0.2 Jasypt默认算法为PBEWithMD5AndDES,该算法需要一个加密密钥,可以在应用启动时指定(环境变量)。也可以直接写入配置文件 3.1 application.properties配置文件版 加密后,可删除jasypt.encryptor.password配置;发版时可在命令行中配置 3.2 函数

    2024年02月15日
    浏览(39)
  • Spring Boot进阶(48):【实战教程】SpringBoot集成WebSocket轻松实现实时消息推送

            WebSocket是一种新型的通信协议,它可以在客户端与服务器端之间实现双向通信,具有低延迟、高效性等特点,适用于实时通信场景。在SpringBoot应用中,集成WebSocket可以方便地实现实时通信功能,如即时聊天、实时数据传输等。         本文将介绍如何在Sprin

    2024年02月09日
    浏览(57)
  • Spring Boot入门(04):SpringBoot实现多环境配置文件切换 | 超级详细,建议收藏

            在开发和部署Spring Boot应用的过程中,经常需要在不同的环境中进行配置,比如开发环境、测试环境、生产环境等。为了方便管理和部署,我们需要实现多环境配置文件切换。本篇教程将带你轻松搞定不同环境部署问题,让你的应用在各个环境中稳定运行。无论你是

    2024年02月12日
    浏览(51)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包