自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(32)
  • 资源 (1)
  • 收藏
  • 关注

原创 docker-compose 集成Jenkins部署,打包,发布

docker-compose集成jenkins的部署,打包,发布

2023-05-14 01:54:44 3106

原创 Mysql转PostgreSQL注意事项

- ifnull()和COALESCE()mysql--ifnull()改pg--COALESCE()ps:mysql -- ifnull(a.audit_result, '')pgsql -- COALESCE(a.audit_result, '')- date_format()和to_date()mysql--date_format()改pg--to_date(),声明类型 ‘ ::text’ps://pg数据库中不能使用'%',如 %y-%m-%dto_date(create_

2022-05-05 13:40:55 1700

原创 Springboot 之 @ConfigurationProperties 注解

@EnableConfigurationProperties 注解的作用是:让使用了 @ConfigurationProperties 注解的类生效,并且将该类注入到 IOC 容器中,交由 IOC 容器进行管理使用 @ConfigurationProperties + @Component 注解,来读取配置文件有时配置@Component注解不生效,可以在启动类上配置@EnableConfigurationProperties注解...

2022-05-05 13:23:06 545

原创 postgresql 除法运算

除法保持小数位的方法ROUND((5/2::NUMERIC),2)异常:ERROR: division by zerodivision by zero 处理方法:case when b = 0 then null else (ROUND((a/b::NUMERIC),2))) end通过case when …then …else…end 来进行除零判断

2022-04-26 13:22:20 5783 1

原创 postgresql使用UUID函数

postgresql有两种生成uuid的方法。可以先通过sql查看是否已安装扩展函数,和可以安装的扩展函数查看已有的扩展函数select * from pg_extension;2. 查看可以安装的扩展函数select * from pg_available_extensions;从中可以看到两种可扩展uuid的函数,一个为1.1版本的,另一个为1.3版本的,可以根据不同的版本选择不同的函数扩展1,安装 pgcrypto 扩展函数安装扩展函数create extension

2022-04-25 13:56:24 17431

原创 Tree树状结构转list,获取从根节点到叶子节点中,每条路径上的所有集合

Tree对象结构:public class B { private Integer id; private String label; private Integer nodeType; private List<B> children; //关键字段 public Integer getId() { return id; } public void setId(Integer id) { this.id = id; }

2022-03-18 10:46:36 871

原创 maven项目中,模块间引用报错:Could not find artifact in public

报错: Failed to execute goal on project: Could not resolve dependencies for project :Could not find artifact in public原因:在非父类模块中的pom.xml引用<packaging>pom</packaging>,至此其他非父类模块无法应用此模块。解决方法:删除<packaging>pom</packaging>...

2022-03-17 10:22:40 5893

原创 idea 2020.3版本 Error running ‘Application‘: Command line is too long.

问题:Error running ‘Application’: Command line is too long.Shorten command line for Applicationor also for Spring Boot default configuration?第一步:第二步:点击 Environment 展开,选择 Shorten command line 下拉框,选中 JAR manifest...

2022-03-10 14:55:41 238

原创 idea中maven项目clean后找不到或无法加载主类

报错:项目clean后,target文件夹消失运行项目,报错:找不到或无法加载主类原因:Edit中,Before launch:Activate tool window没有配置解决方法:添加Build配置即可运行成功:

2021-12-13 09:03:51 1478

原创 maven打jar包时使用<compilerArguments>标签遇到的报错问题

问题单独使用 bootclasspath 标签时<compilerArguments> <bootclasspath>${java.home}/lib</bootclasspath></compilerArguments>问题说明:在maven打jar包时,先clean再install时报错[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugi

2021-09-28 11:02:32 3142

原创 @Component 注入到其它包下的方法

一,1,在启动类上声明注解 @ComponentScan 在里面填写 @Component注解所在的包路径,可以多路径配置@SpringBootApplication@EnableOpenApi // 路径:/swagger-ui/index.html@ComponentScan("com.abdas.common.MybatisPlus")public class ServiceApplication { public static void main(String[] args) {

2021-08-27 09:53:14 1930

原创 七大设计原则

一、开闭原则开闭原则是指一个软件实体如类、模块和函数应该对扩展开放,对修改关闭。可以提高软件系统的可复用性及可维护性。开闭原则,是面向对象设计中最基础的设计原则。以商品为例:/** * 商品通用接口 */public interface IShangPin { String getName();//名字 Double getPrice();//价格}创建一个商品类实现商品接口public class ShangPin implements IShangPin{

2021-07-16 17:38:56 79

转载 SpringBoot2.0给所有Controller添加统一前缀

需求  给所有Controller添加统一前缀实现  在配置文件中添加:server: servlet: context-path: /base(不同SpringBoot版本会有区别,这里是采用2.0)原请求路径:http://localhsot:9999/jyzt/fypage添加后请求路径:http://localhsot:9999/base/jyzt/fypage...

2020-11-18 10:05:19 1033

原创 Mybatis查询时,用Map集合接收字段为空不返回key值问题

在application.xml中配置mybatis-plus: configuration: call-setters-on-nulls: true # 当字段为空时,返回为null

2020-11-16 14:48:27 881

转载 OpenFeign和Hystrix超时时长设置及详解

概念明确:hystrix可配置的部分:hystrix.command.default.execution.timeout.enable=true //为false则超时控制有ribbon控制,为true则hystrix超时和ribbon超时都是用,但是谁小谁生效,默认为truehystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=3000//熔断器的超时时长默认1秒,最常修改的参数circuitBreak

2020-10-10 11:29:21 3402

转载 Hystrix 用法,@HystrixProperty参数说明

Hystrix 用法及注解用法一、hystrix参数使用方法通过注解@HystrixCommand的commandProperties去配置,如下就是hystrix命令超时时间命令执行超时时间,为1000ms和执行是不启用超时@RestControllerpublic class MovieController { @Autowired private RestTemplate restTemplate; @GetMapping("/movie/{id}") @HystrixCo

2020-10-09 17:02:56 6325

原创 springboot 根据sessionId查询session

问题:跨域问题,session无法进行同步,可以通过保存session和sessionId的方式进行校验,向前端传送sessionId,前端可以通过头部传sessionId,通过sessionId获取相关的信息,进行校验等操作1,创建一个类用于保存session,对session进行添加,删除,查询/** * 自定义获取指定sessionId的session */public class MySessionContext { private static MySessionContext

2020-09-19 10:29:45 2561 1

原创 认证授权中解决AuthenticationManager 无法注入

在启动springboot项目时,提示AuthenticationManager无法注入问题报如下错误:Description:Field authenticationManager in com.security.uaa.config.AuthorizationServer required a bean of type 'org.springframework.security.authentication.AuthenticationManager' that could not be fo

2020-08-14 10:53:05 9300 2

原创 java中位移运算符

java中位移运算符// << : 左移运算符,num << 3,相当于num乘以2的3次方// >> : 右移运算符,num >> 1,相当于num除以2的1次方// << : 左移运算符,num << 3,相当于num乘以2的3次方int number = 10;number = number << 3;System.out.println(number); // 80// >>

2020-08-03 16:08:10 83

原创 Mysql通过分页查询处理百万条数据(单线程)

Mysql查询百万数据:(亲测!!! 数据迁移,800万数据,先查询后添加,三个半小时完成)查询方法如下: /** * 查询 * * @param args */ public static void main(String[] args) throws Exception { int count = 8540934;//通过count查到数据总量 int num = 10000;//每次查询的条数 //

2020-07-29 16:53:44 489

原创 找出两个数组中相同(或不相同)的元素

/** * 找出两个数组中相同的元素 * @param a * @param b * @return */ public static <T> Set<T> getSame(T[] a, T[] b){ Set<T> same = new HashSet<T>(); //用来存放两个数组中相同的元素 Set<T> temp = new HashSe...

2020-07-29 16:37:29 763

原创 将List<Map<String,Object>>格式转为json字符串格式

/** * 将List<Map<String,Object>>格式转为json字符串格式 * @param mapList 格式:[{level=1, customItem=a}, {level=2, customItem=a}, {level=3, customItem=a}] * @return json字符串 */ public static String getMapList(List<Map<String,Obj

2020-07-29 16:34:52 5184

原创 springboot + springsecurity实现动态url细粒度权限认证

谨记:Url表只储存受保护的资源,不在表里的资源说明不受保护,任何人都可以访问1、MyFilterInvocationSecurityMetadataSource 类判断该访问路径是否被保护@Component//用于设置受保护资源的权限信息的数据源public class MyFilterInvocationSecurityMetadataSource implements FilterInvocationSecurityMetadataSource { @Bean

2020-07-16 17:18:14 1134 1

原创 SpringBoot @Autowired注解失效

问题现象描述:如果类A中存在类B, B是通过@Autowired自动注入,而类A的实例是通过new的方式产生的,那么自动注入会失效的,此时需要通过其他方式来注入B 解决方法:把new出来的示例,改为通过@Autowired注入的方式...

2020-07-14 16:52:34 662

原创 部署多个springboot项目到同一个服务器application启动失败

解决方法:只需要增加一项配置 spring.jmx.default-domain给不同的application即可。application.yml中配置spring: application: name: test jmx: default-domain: testname和jmx名称保持一致(不一致结果没试过)每个项目的jmx名字必须是唯一的!!...

2020-07-09 09:57:34 846

原创 关于删除tomcat下旧项目部署新项目

tomcat只能运行一个项目的情况下:记录:项目需要在tomcat中部署,于是把原来部署在tomcat中的项目给删了,部署新的项目。在tomcat上启动startup.bat时,依然启动了原来的项目原因:我在idea中部署了tomcat,在Deployment中添加相关war包,所以启动startup.bat时还会运行原来的项目解决方法:把Deployment中添加的war包删除,或者换成新的项目的war包,运行成功...

2020-06-22 14:46:55 1065

原创 运行tomcat时报“404-未找到“问题

把springboot项目部署在tomcat的wabapps中,运行时报"404-未找到"错误原因:请求时路径不正确解决方法:直接运行springboot项目时路径为:localhost:端口/接口 如:localhost:8090/app/findId?id=1部署在tomcat的wabapps中后,请求路径为:localhost:端口/文件名/接口 如:localhost:8080/farming/app/findId?id=1端口:tomcat的端口 例:localhost:8

2020-06-22 11:01:15 3513

原创 Oralce+Mybatis以list集合批量插入数据

这是一个mapper接口,Users_Roles是一个实体类@Mapperpublic interface FPYHMapper { void usersAddAll(ArrayList<Users_Roles> list);}mapper.xml 中的数据 <!--批量添加信息--> <insert id="usersAddAll" parameterType="list"> insert into users_roles(u

2020-06-05 11:23:52 128

转载 spring boot整合security跨域问题

在继承extends WebSecurityConfigurerAdapter中配置如下两个操作@Override protected void configure(HttpSecurity http) throws Exception { //cors开启跨域请求 http.cors().configurationSource(CorsConfigurationSource()) //跨域配置 @Bean CorsConfigurationSo

2020-06-05 10:54:31 391

原创 springsecurity短信登录

springsecurity短信登录SendSmsFilter 类SendSmsAuthenticationFilter类SendSmsAuthenticationToken类SendSmsAuthenticationProvider类SendSmsSecurityConfig类继springboot+springsecurity+JWT文章,实现短信登录springboot+springse...

2020-05-09 12:02:08 771

原创 springboot+springsecurity+JWT

springboot+springsecurity+JWT目录结构:springbootApplication里面的配置,如有需要可以自行添加实现JWT功能在pom.xml中的配置<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" ...

2020-05-07 16:13:18 833

原创 resources里面配置的静态文件无法解决的最终方法

创建一个TomcatConfig@Configurationpublic class TomcatConfig { @Value("${bw.factory.doc.root}") private String rootDoc; @Bean public AbstractServletWebServerFactory embeddedServletCont...

2020-05-07 15:22:46 554

jenkins流水线脚本

jenkins流水线脚本

2023-05-14

springboot+security.zip

springboot整合security+jwt实现单点登录,包含短信登录,用redis进行保存和校验

2020-06-05

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除