spring demo aop
Spring Boot中的全局异常处理
1.1 Spring Boot中的全局异常处理在项目开发过程中,不管是对底层数据库的操作过程,还是业务层的处理过程,还是控制层的处理过程,都不可避免会遇到各种可预知的、不可预知的异常需要处理。如果对每个过程都单独作异常处理,那系统的代码耦合度会变得很高,此外,开发工作量也会加大而且不好统一,这也增加 ......
记spring-security升级,引发的redis反序列化不一致问题
问题解决参考文章如下: https://my.oschina.net/klblog/blog/5559133 https://blog.csdn.net/qq_37421368/article/details/124850449 问题复现 由于一些原因,登录的token由旧版本的微服务存入的redi ......
spring注解整合Junit
import com.hw.config.SpringConfig; import com.hw.domain.User; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import ......
Spring注解系列——@PropertySource
在Spring框架中@PropertySource注解是非常常用的一个注解,其主要作用是将外部化配置解析成key-value键值对"存入"Spring容器的Environment环境中,以便在Spring应用中可以通过@Value或者占位符${key}的形式来使用这些配置。 使用案列 // @Pro ......
Spring 使用 @Import 的好处是啥?
@Enbale模块驱动的基本原理 在我们平时使用spring的过程中,如果想要加个定时任务的功能,那么就需要加注解@EnableScheduling,如果想使用异步的功能,那就要加@EnableAsync注解,其实这类注解就是属于@Enable模块。 那么@Enable模块到底有什么功能? 模块是指 ......
Spring 源码阅读之标签解析
全局目录.md 引子 1、容器最基本使用.md 系列1 - bean 标签解析: 2、XmlBeanFactory 的类图介绍.md 3、XmlBeanFactory 对xml文件读取.md 4、xml配置文件解析之【默认】命名空间【标签】的解析.md 5、xml配置文件解析之【自定义】命名空间【标 ......
spring---->Spring事务与ApplicationEventPublisher
Spring事务与ApplicationEventPublisher @Transactional public void handle() { var account = Account.builder() .username("huhx") .password("pass") .build(); ......
spring导入第三方资源对应的配置类
import com.alibaba.druid.pool.DruidDataSource; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotatio ......
myBatis与spring集成配置
1.Mybatis与Spring集成配置 基于idea创建archetype-maven-webapp项目。(要求:jdk1.8+web3.0) 1.1.添加依赖 <properties> <project.build.sourceEncoding>UTF-8</project.build.sour ......
JNI demo使用及逆向技巧
JNI 使用语法 官方文档如下:https://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/jniTOC.html JNI 类型 | Java类型 | 本地类型 | 描述 | c类型 | | | | | : | | int | ji ......
Spring Cache使用方式——不用默认,使用redis进行缓存
在Spring Boot项目中使用Spring Cache的操作步骤(使用redis缓存技术) 1、导入Maven坐标 spring-boot-starter-data-redis、sping-boot-starter-cache 2、配置application.yml spring: cache: ......
Spring Cache使用
package com.itheima.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.itheima.entity.User; import com.i ......
BERT-文本分类demo
title: Bert文本分类 一.模型准备 首先在huggingface上下载对应的模型,也可以通过安装transformer,来将tensorflow版模型改为pytorch版。 最后得到:config.json、pytorch_model.bin 和 vocab.txt。 1.config.j ......
spring整合mybatis
效果 在不注入sqlSession的情况下 第一种方法:再bean实例化的时候,可以重写BeanDefinitionRegistryPostProcessor,在这里修改beanDefinition,将factoryBean注入到beanClassName,然后注入构造方法,其参数为maper.cl ......
cube的Demo
代码参考: use Demo go select Name,ExamNode ,Course,avg(Num) from SumDemo group by Name,ExamNode,Course with cube order by Name desc,ExamNode desc,Course d ......
Spring Cache
Spring Cache是一个框架,实现了基于注解的缓存功能,只需要简单地加一个注释,就能实现缓存功能。 Spring Cache提供了一层抽象,底层可以切换不同的Cache实现。具体就是通过CacheManager接口来统一不同的缓存技术 CacheManager是Spring提供的各种缓存技术抽 ......
Spring学习
Spring快速学习 HelloSpring 1、新建maven项目 2、导入spring相关依赖 <dependencies> <!-- Spring依赖 --> <!-- 1.Spring核心依赖 --> <dependency> <groupId>org.springframework</gr ......
spring注解配置第三方资源
@Bean("dataSource") public DruidDataSource getDataSource(){ DruidDataSource ds =new DruidDataSource(); ds.setDriverClassName("com.mysql.jdbc.Driver"); ......
spring boot搭建出现的问题
1.spring boot 2.0报错: dataSource or dataSourceClassName or jdbcUrl is required.] with root cause 原因:springboot连接数据库是默认的是 :spring.datasource为前缀 而在代码中mys ......
C# ActiveMQ使用demo
安装流程在上一篇 引入包 在nuget中下载安装Apache.NMS.ActiveMQ 如图 收发都要 引入 using Apache.NMS; using Apache.NMS.ActiveMQ; 发信方 IConnectionFactory factory = new ConnectionFac ......
6步带你用Spring Boot开发出商城高并发秒杀系统
摘要:本博客将介绍如何使用 Spring Boot 实现一个简单的商城秒杀系统,并通过使用 Redis 和 MySQL 来增强其性能和可靠性。 本文分享自华为云社区《Spring Boot实现商城高并发秒杀案例》,作者:林欣。 随着经济的发展和人们消费观念的转变,电子商务逐渐成为人们购物的主要方式之 ......
idea启动spring项目
原文连接:https://blog.csdn.net/w_t_y_y/article/details/100337840 一、没有安装tomcat: 1、点击 进入: 2、点maven,点击左上角+号: 配置spring项目: (1)在parameters的command file中输入: org. ......
聊聊spring中bean的作用域
前言 今天分享一下spring bean的作用域,理解bean的作用域能够在使用过程中避免一些问题,bean的作用域也是spring bean创建过程中一个重要的点。 Spring bean的作用域类型 singleton(单例模式):在整个应用程序的生命周期中,只创建一个Bean实例。默认情况下, ......
spring事务
步骤; 1.在要开事务的方法上面加一个@Transactional 2.设置事务管理器: 3.在config里enable一下事务管理,写个@EnableTransactionManagement 角色: spring事务相关配置: ......
spring boot 极简案例
安装idea File -> New Project 选择依赖 创建controller文件 输入controller类名 输入代码 运行项目 访问 localhost:8080/hello/boot package com.example.demo; import org.springframew ......