- ubuntu12.04环境下使用kvm ioctl接口实现最简单的虚拟机
- Ubuntu 通过无线网络安装Ubuntu Server启动系统后连接无线网络的方法
- 在Ubuntu上搭建网桥的方法
- ubuntu 虚拟机上网方式及相关配置详解
CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界.
这篇CFSDN的博客文章Redis和springboot 整合redisUtil类的示例代码由作者收集整理,如果你对这篇文章有兴趣,记得点赞哟.
。
1、引入依赖 。
1
2
3
4
|
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
|
。
2、在application.yml 配置redis服务器 。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
spring:
# 环境 dev|test|prod
profiles:
active: dev
servlet:
multipart:
max-file-size: 100MB
max-request-size: 100MB
enabled:
true
redis:
database:
0
# Redis服务器数据库
host:
192.168
.
6.27
# Redis服务器地址
port:
6379
# Redis服务器连接端口
password:
123456
# Redis服务器连接密码(默认为空)
timeout: 6000ms # 连接超时时间(毫秒)
jedis:
pool:
max-active:
200
# 连接池最大连接数(使用负值表示没有限制)
max-wait: -
1
# 连接池最大阻塞等待时间(使用负值表示没有限制)
max-idle:
10
# 连接池中的最大空闲连接
min-idle:
0
# 连接池中的最小空闲连接
|
。
3、写一个redis配置类 。
(1)聊聊RedisTemplate的自动配置 其实现在就可以在代码中注入RedisTemplate,为啥可以直接注入呢?先看下源码吧。下图为RedisAutoConfiguration类中的截图,为了防止图片失效,代码也贴上.
通过源码可以看出,SpringBoot自动帮我们在容器中生成了一个RedisTemplate和一个StringRedisTemplate。但是,这个RedisTemplate的泛型是<Object,Object>,写代码不方便,需要写好多类型转换的代码;我们需要一个泛型为<String,Object>形式的RedisTemplate。并且,这个RedisTemplate没有设置数据存在Redis时,key及value的序列化方式。 看到这个@ConditionalOnMissingBean注解后,就知道如果Spring容器中有了RedisTemplate对象了,这个自动配置的RedisTemplate不会实例化。因此我们可以直接自己写个配置类,配置RedisTemplate。(2)既然自动配置不好用,就重新配置一个RedisTemplate 。
包的结构如下 。
代码如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
package
com.yux.redisdemo.redis;
import
org.springframework.context.annotation.Bean;
import
org.springframework.context.annotation.Configuration;
import
org.springframework.data.redis.connection.RedisConnectionFactory;
import
org.springframework.data.redis.core.RedisTemplate;
import
org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import
org.springframework.data.redis.serializer.StringRedisSerializer;
import
com.fasterxml.jackson.annotation.JsonAutoDetect;
import
com.fasterxml.jackson.annotation.PropertyAccessor;
import
com.fasterxml.jackson.databind.ObjectMapper;
/**
15
* redis配置类
16
* @author YUX
17
* @date 2018年6月6日
18
*
19
*/
@Configuration
public
class
RedisConfig {
@Bean
@SuppressWarnings
(
"all"
)
public
RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
RedisTemplate<String, Object> template =
new
RedisTemplate<String, Object>();
template.setConnectionFactory(factory);
Jackson2JsonRedisSerializer jackson2JsonRedisSerializer =
new
Jackson2JsonRedisSerializer(Object.
class
);
ObjectMapper om =
new
ObjectMapper();
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
jackson2JsonRedisSerializer.setObjectMapper(om);
StringRedisSerializer stringRedisSerializer =
new
StringRedisSerializer();
// key采用String的序列化方式
template.setKeySerializer(stringRedisSerializer);
// hash的key也采用String的序列化方式
template.setHashKeySerializer(stringRedisSerializer);
// value序列化方式采用jackson
template.setValueSerializer(jackson2JsonRedisSerializer);
// hash的value序列化方式采用jackson
template.setHashValueSerializer(jackson2JsonRedisSerializer);
template.afterPropertiesSet();
return
template;
}
}
|
。
4、编写一个RedisUtil类 。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
|
package
com.yux.redisdemo.redis;
import
java.util.List;
import
java.util.Map;
import
java.util.Set;
import
java.util.concurrent.TimeUnit;
import
org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.data.redis.core.RedisTemplate;
import
org.springframework.stereotype.Component;
import
org.springframework.util.CollectionUtils;
/**
14
* Redis工具类
15
* @author YUX
16
* @date 2018年6月7日
17
*/
@Component
public
final
class
RedisUtil {
@Autowired
private
RedisTemplate<String, Object> redisTemplate;
// =============================common============================
/**
* 26
* 指定缓存失效时间
* 27
*
* @param key 键
* 28
* @param time 时间(秒)
* 29
* @return 30
*/
public
boolean
expire(String key,
long
time) {
try
{
if
(time >
0
) {
redisTemplate.expire(key, time, TimeUnit.SECONDS);
}
return
true
;
}
catch
(Exception e) {
e.printStackTrace();
return
false
;
}
}
/**
* 44
* 根据key 获取过期时间
* 45
*
* @param key 键 不能为null
* 46
* @return 时间(秒) 返回0代表为永久有效
* 47
*/
public
long
getExpire(String key) {
return
redisTemplate.getExpire(key, TimeUnit.SECONDS);
}
/**
* 53
* 判断key是否存在
* 54
*
* @param key 键
* 55
* @return true 存在 false不存在
* 56
*/
public
boolean
hasKey(String key) {
try
{
return
redisTemplate.hasKey(key);
}
catch
(Exception e) {
e.printStackTrace();
return
false
;
}
}
/**
* 67
* 删除缓存
* 68
*
* @param key 可以传一个值 或多个
* 69
*/
@SuppressWarnings
(
"unchecked"
)
public
void
del(String... key) {
if
(key !=
null
&& key.length >
0
) {
if
(key.length ==
1
) {
redisTemplate.delete(key[
0
]);
}
else
{
redisTemplate.delete(CollectionUtils.arrayToList(key));
}
}
}
// ============================String=============================
/**
* 83
* 普通缓存获取
* 84
*
* @param key 键
* 85
* @return 值
* 86
*/
public
Object get(String key) {
return
key ==
null
?
null
: redisTemplate.opsForValue().get(key);
}
/**
* 92
* 普通缓存放入
* 93
*
* @param key 键
* 94
* @param value 值
* 95
* @return true成功 false失败
* 96
*/
public
boolean
set(String key, Object value) {
try
{
redisTemplate.opsForValue().set(key, value);
return
true
;
}
catch
(Exception e) {
e.printStackTrace();
return
false
;
}
}
/**
* 109
* 普通缓存放入并设置时间
* 110
*
* @param key 键
* 111
* @param value 值
* 112
* @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期
* 113
* @return true成功 false 失败
* 114
*/
public
boolean
set(String key, Object value,
long
time) {
try
{
if
(time >
0
) {
redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS);
}
else
{
set(key, value);
}
return
true
;
}
catch
(Exception e) {
e.printStackTrace();
return
false
;
}
}
/**
* 130
* 递增
* 131
*
* @param key 键
* 132
* @param delta 要增加几(大于0)
* 133
* @return 134
*/
public
long
incr(String key,
long
delta) {
if
(delta <
0
) {
throw
new
RuntimeException(
"递增因子必须大于0"
);
}
return
redisTemplate.opsForValue().increment(key, delta);
}
/**
* 143
* 递减
* 144
*
* @param key 键
* 145
* @param delta 要减少几(小于0)
* 146
* @return 147
*/
public
long
decr(String key,
long
delta) {
if
(delta <
0
) {
throw
new
RuntimeException(
"递减因子必须大于0"
);
}
return
redisTemplate.opsForValue().increment(key, -delta);
}
// ================================Map=================================
/**
* 157
* HashGet
* 158
*
* @param key 键 不能为null
* 159
* @param item 项 不能为null
* 160
* @return 值
* 161
*/
public
Object hget(String key, String item) {
return
redisTemplate.opsForHash().get(key, item);
}
/**
* 167
* 获取hashKey对应的所有键值
* 168
*
* @param key 键
* 169
* @return 对应的多个键值
* 170
*/
public
Map<Object, Object> hmget(String key) {
return
redisTemplate.opsForHash().entries(key);
}
/**
* 176
* HashSet
* 177
*
* @param key 键
* 178
* @param map 对应多个键值
* 179
* @return true 成功 false 失败
* 180
*/
public
boolean
hmset(String key, Map<String, Object> map) {
try
{
redisTemplate.opsForHash().putAll(key, map);
return
true
;
}
catch
(Exception e) {
e.printStackTrace();
return
false
;
}
}
/**
* 192
* HashSet 并设置时间
* 193
*
* @param key 键
* 194
* @param map 对应多个键值
* 195
* @param time 时间(秒)
* 196
* @return true成功 false失败
* 197
*/
public
boolean
hmset(String key, Map<String, Object> map,
long
time) {
try
{
redisTemplate.opsForHash().putAll(key, map);
if
(time >
0
) {
expire(key, time);
}
return
true
;
}
catch
(Exception e) {
e.printStackTrace();
return
false
;
}
}
/**
* 212
* 向一张hash表中放入数据,如果不存在将创建
* 213
*
* @param key 键
* 214
* @param item 项
* 215
* @param value 值
* 216
* @return true 成功 false失败
* 217
*/
public
boolean
hset(String key, String item, Object value) {
try
{
redisTemplate.opsForHash().put(key, item, value);
return
true
;
}
catch
(Exception e) {
e.printStackTrace();
return
false
;
}
}
/**
* 229
* 向一张hash表中放入数据,如果不存在将创建
* 230
*
* @param key 键
* 231
* @param item 项
* 232
* @param value 值
* 233
* @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间
* 234
* @return true 成功 false失败
* 235
*/
public
boolean
hset(String key, String item, Object value,
long
time) {
try
{
redisTemplate.opsForHash().put(key, item, value);
if
(time >
0
) {
expire(key, time);
}
return
true
;
}
catch
(Exception e) {
e.printStackTrace();
return
false
;
}
}
/**
* 250
* 删除hash表中的值
* 251
*
* @param key 键 不能为null
* 252
* @param item 项 可以使多个 不能为null
* 253
*/
public
void
hdel(String key, Object... item) {
redisTemplate.opsForHash().delete(key, item);
}
/**
* 259
* 判断hash表中是否有该项的值
* 260
*
* @param key 键 不能为null
* 261
* @param item 项 不能为null
* 262
* @return true 存在 false不存在
* 263
*/
public
boolean
hHasKey(String key, String item) {
return
redisTemplate.opsForHash().hasKey(key, item);
}
/**
* 269
* hash递增 如果不存在,就会创建一个 并把新增后的值返回
* 270
*
* @param key 键
* 271
* @param item 项
* 272
* @param by 要增加几(大于0)
* 273
* @return 274
*/
public
double
hincr(String key, String item,
double
by) {
return
redisTemplate.opsForHash().increment(key, item, by);
}
/**
* 280
* hash递减
* 281
*
* @param key 键
* 282
* @param item 项
* 283
* @param by 要减少记(小于0)
* 284
* @return 285
*/
public
double
hdecr(String key, String item,
double
by) {
return
redisTemplate.opsForHash().increment(key, item, -by);
}
// ============================set=============================
/**
* 292
* 根据key获取Set中的所有值
* 293
*
* @param key 键
* 294
* @return 295
*/
public
Set<Object> sGet(String key) {
try
{
return
redisTemplate.opsForSet().members(key);
}
catch
(Exception e) {
e.printStackTrace();
return
null
;
}
}
/**
* 306
* 根据value从一个set中查询,是否存在
* 307
*
* @param key 键
* 308
* @param value 值
* 309
* @return true 存在 false不存在
* 310
*/
public
boolean
sHasKey(String key, Object value) {
try
{
return
redisTemplate.opsForSet().isMember(key, value);
}
catch
(Exception e) {
e.printStackTrace();
return
false
;
}
}
/**
* 321
* 将数据放入set缓存
* 322
*
* @param key 键
* 323
* @param values 值 可以是多个
* 324
* @return 成功个数
* 325
*/
public
long
sSet(String key, Object... values) {
try
{
return
redisTemplate.opsForSet().add(key, values);
}
catch
(Exception e) {
e.printStackTrace();
return
0
;
}
}
/**
* 336
* 将set数据放入缓存
* 337
*
* @param key 键
* 338
* @param time 时间(秒)
* 339
* @param values 值 可以是多个
* 340
* @return 成功个数
* 341
*/
public
long
sSetAndTime(String key,
long
time, Object... values) {
try
{
Long count = redisTemplate.opsForSet().add(key, values);
if
(time >
0
)
expire(key, time);
return
count;
}
catch
(Exception e) {
e.printStackTrace();
return
0
;
}
}
/**
* 355
* 获取set缓存的长度
* 356
*
* @param key 键
* 357
* @return 358
*/
public
long
sGetSetSize(String key) {
try
{
return
redisTemplate.opsForSet().size(key);
}
catch
(Exception e) {
e.printStackTrace();
return
0
;
}
}
/**
* 369
* 移除值为value的
* 370
*
* @param key 键
* 371
* @param values 值 可以是多个
* 372
* @return 移除的个数
* 373
*/
public
long
setRemove(String key, Object... values) {
try
{
Long count = redisTemplate.opsForSet().remove(key, values);
return
count;
}
catch
(Exception e) {
e.printStackTrace();
return
0
;
}
}
// ===============================list=================================
/**
* 386
* 获取list缓存的内容
* 387
*
* @param key 键
* 388
* @param start 开始
* 389
* @param end 结束 0 到 -1代表所有值
* 390
* @return 391
*/
public
List<Object> lGet(String key,
long
start,
long
end) {
try
{
return
redisTemplate.opsForList().range(key, start, end);
}
catch
(Exception e) {
e.printStackTrace();
return
null
;
}
}
/**
* 402
* 获取list缓存的长度
* 403
*
* @param key 键
* 404
* @return 405
*/
public
long
lGetListSize(String key) {
try
{
return
redisTemplate.opsForList().size(key);
}
catch
(Exception e) {
e.printStackTrace();
return
0
;
}
}
/**
* 416
* 通过索引 获取list中的值
* 417
*
* @param key 键
* 418
* @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推
* 419
* @return 420
*/
public
Object lGetIndex(String key,
long
index) {
try
{
return
redisTemplate.opsForList().index(key, index);
}
catch
(Exception e) {
e.printStackTrace();
return
null
;
}
}
/**
* 431
* 将list放入缓存
* 432
*
* @param key 键
* 433
* @param value 值
* 434
* @param time 时间(秒)
* 435
* @return 436
*/
public
boolean
lSet(String key, Object value) {
try
{
redisTemplate.opsForList().rightPush(key, value);
return
true
;
}
catch
(Exception e) {
e.printStackTrace();
return
false
;
}
}
/**
* 将list放入缓存
*
* @param key 键
* @param value 值
* @param time 时间(秒)
* @return
*/
public
boolean
lSet(String key, Object value,
long
time) {
try
{
redisTemplate.opsForList().rightPush(key, value);
if
(time >
0
)
expire(key, time);
return
true
;
}
catch
(Exception e) {
e.printStackTrace();
return
false
;
}
}
/**
* 467
* 将list放入缓存
* 468
*
* @param key 键
* 469
* @param value 值
* 470
* @param time 时间(秒)
* 471
* @return 472
*/
public
boolean
lSet(String key, List<Object> value) {
try
{
redisTemplate.opsForList().rightPushAll(key, value);
return
true
;
}
catch
(Exception e) {
e.printStackTrace();
return
false
;
}
}
/**
* 484
* 将list放入缓存
* 485
* <p>
* 486
*
* @param key 键
* 487
* @param value 值
* 488
* @param time 时间(秒)
* 489
* @return 490
*/
public
boolean
lSet(String key, List<Object> value,
long
time) {
try
{
redisTemplate.opsForList().rightPushAll(key, value);
if
(time >
0
)
expire(key, time);
return
true
;
}
catch
(Exception e) {
e.printStackTrace();
return
false
;
}
}
/**
* 504
* 根据索引修改list中的某条数据
* 505
*
* @param key 键
* 506
* @param index 索引
* 507
* @param value 值
* 508
* @return 509
*/
public
boolean
lUpdateIndex(String key,
long
index, Object value) {
try
{
redisTemplate.opsForList().set(key, index, value);
return
true
;
}
catch
(Exception e) {
e.printStackTrace();
return
false
;
}
}
/**
* 521
* 移除N个值为value
* 522
*
* @param key 键
* 523
* @param count 移除多少个
* 524
* @param value 值
* 525
* @return 移除的个数
* 526
*/
public
long
lRemove(String key,
long
count, Object value) {
try
{
Long remove = redisTemplate.opsForList().remove(key, count, value);
return
remove;
}
catch
(Exception e) {
e.printStackTrace();
return
0
;
}
}
}
|
。
5、在service中注入RedisUtil可用 。
到此这篇关于Redis和springboot 整合redisUtil类的示例代码的文章就介绍到这了,更多相关Redis和springboot 整合redisUtil类内容请搜索我以前的文章或继续浏览下面的相关文章希望大家以后多多支持我! 。
原文链接:https://www.cnblogs.com/yui66/p/9935927.html#4778418 。
最后此篇关于Redis和springboot 整合redisUtil类的示例代码的文章就讲到这里了,如果你想了解更多关于Redis和springboot 整合redisUtil类的示例代码的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。
SpringBoot-Admin 服务监控 简单介绍 Spring Boot Actuator 是 Spring Boot 自带的一个功能模块, 提供了一组已经开箱即用的生产环境下常用
我想查找通过关键字匹配字段 nameEnglish 或 nameChinese 的模型列表。我花了一个多小时谷歌搜索但我做不到。请帮忙。 Springboot Mongo 入门示例 https://s
(请注意:在调查 this issue 时,我更好地发现了我在此处介绍的问题根源) 我对 Hibernate 和 SpringBoot 非常陌生。我的项目涉及一个搜索引擎,其中索引(javafx 客户
我最近有一个 Web 应用程序从 springboot 升级到 springboot 2。当我将其部署到 Tomcat 8 时,它似乎启动了,但没有完全启动。 在 localhost.2019-09-
我是 Spring boot 的新手...我在运行 Controller 时遇到问题, Description: Field todoService in com.springboot.todoCon
我有一个SpringBoot应用程序,它使用以下配置与PostgreSQL通信,通过AWS Beanstrik部署:。在我将AWS Aurora证书更新为rds-ca-ecc384-g1之前,一切都很
一、介绍 在实际的软件系统开发过程中,由于业务的需求,在代码层面实现数据的脱敏还是远远不够的,往往还需要在数据库层面针对某些关键性的敏感信息,例如:身份证号、银行卡号、手机号、工资等信息进行加密存储
Selenium Selenium是一个用于Web应用程序自动化测试的开源工具套件。它主要用于以下目的: 浏览器自动化:Selenium能够模拟真实用户在不同浏览器(如Chrome、Fire
一、简介 在实际的项目开发过程中,经常需要用到邮件通知功能。例如,通过邮箱注册,邮箱找回密码,邮箱推送报表等等,实际的应用场景非常的多。 早期的时候,为了能实现邮件的自动发送功能,通常会使用 Ja
SpringBoot:基于redis自定义注解实现后端接口防重复提交校验 一、添加依赖 org.springframework.boot spring
SpringBoot:使用Jackson完成全局序列化配置 一、测试准备 com.fasterxml.jackson.core jackson-cor
springboot:整合rocketmq 一、简易消息操作 生产者整合mq 导入依赖 org.springframework.boot
springboot:常用注解 一、spring常用注解 包扫描+组件标注注解 @Component:泛指各种组件 @Controller、@Service、@Repository都可以称为@Comp
我们经常需要在两个系统之间进行一些数据的交互,这时候我们就需要开发数据交互接口。 一般来说,遇到比较多的接口有HTTP接口、WebService接口、FTP文件传输。今天我要来学习一下在SpringB
背景 近期项目上线,甲方要求通过安全检测才能进行验收,故针对扫描结果对系统进行了一系列的安全加固,本文对一些常见的安全问题及防护策略进行介绍,提供对应的解决方案 跨站脚本攻击 XSS常发生于论坛评论等
1.排除 Spring-boot-starter 默认的日志配置 将原本的 spring-boot-starter 改为 org.springframework.boot
springboot:解决跨域问题 一、跨域简介 URL的组成: // 协议 + 域名(子域名 + 主域名) + 端口号 + 资源地址 http://www.baidu.com:8080/ 只要协
一、自定义Starter 的思路: 创建一个Maven工程,创建三个模块 一个模块为demo-app,一个模块为demo-module,一个模块为demo-module-springboot-star
1.pom.xml 4.0.0 org.springframework.boot spring-boot-starter-parent
1.pom.xml 4.0.0 org.springframework.boot spring-boot-starter-parent
我是一名优秀的程序员,十分优秀!