Home | 简体中文 | 繁体中文 | 杂文 | Github | 知乎专栏 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏

Netkiller Java 手札(2024版)

Java, Servlet, JavaBean, Struts, Spring ...

Mr. Neo Chan, 陈景峯(BG7NYT)



中国广东省深圳市望海路半岛城邦三期
518067
+86 13113668890


文档始创于 2015-11-10

电子书最近一次更新于 2024-02-29 18:07:20

版权声明

转载请与作者联系,转载时请务必标明文章原始出处和作者信息及本声明。

http://www.netkiller.cn
http://netkiller.github.io
http://netkiller.sourceforge.net
微信公众号: netkiller
微信:13113668890 请注明“读者”
QQ:13721218 请注明“读者”
QQ群:128659835 请注明“读者”
知乎专栏

2017-11

关于《Netkiller Java 手札》

作者2002年开始在项目中使用Java,各种原因没有留下Java文档,2015因工作需要重新拾起Java并整理本文档。

本电子书重点内容是Spring boot, Spring cloud, Spring data, Spring security


致读者

Netkiller 系列手札 已经被 Github 收录,并备份保存在北极地下250米深的代码库中,备份会保留1000年。

Preserving open source software for future generations

The world is powered by open source software. It is a hidden cornerstone of modern civilization, and the shared heritage of all humanity.

The GitHub Arctic Code Vault is a data repository preserved in the Arctic World Archive (AWA), a very-long-term archival facility 250 meters deep in the permafrost of an Arctic mountain.

We are collaborating with the Bodleian Library in Oxford, the Bibliotheca Alexandrina in Egypt, and Stanford Libraries in California to store copies of 17,000 of GitHub’s most popular and most-depended-upon projects—open source’s “greatest hits”—in their archives, in museum-quality cases, to preserve them for future generations.

https://archiveprogram.github.com/arctic-vault/

目录

1. 自述
1.1. 写给读者
1.2. 作者简介
1.3. 如何获得文档
1.4. 打赏(Donations)
1.5. 联系方式
I. Java 21
1. JVM
1.1. Almalinux / RockyLinux
1.2. CentOS 8 Java 14
1.3. Java 版本切换
1.4. 安装 Java 6
1.4.1. HeapDumpOnOutOfMemoryError
1.5. java-1.8.0-openjdk
1.6. docker 环境
1.7. java - Launches a Java application.
1.7.1. java 9~11
1.7.2. -verbose:class 显示载入jar文件
1.7.3. java.io.tmpdir
1.7.4. 显示版本号
1.7.5. 列出java模块
1.8. Java 相关命令
1.8.1. jps
1.8.2. jar
1.8.3. jdeps - Java class dependency analyzer.
1.8.4. JShell
1.8.5. jlink
2. exec 运行shell
2.1. System
2.1.1. user.dir
2.1.2. java.io.tmpdir
2.1.3. 打印当前 Java 文件的默认编码
2.1.4. 自定义
2.1.5. System.in 标准输入(Stdin)
2.1.6. ANSI Color
3. 数据类型
3.1. var 本地变量类型推断
3.2. Integer 整形
3.2.1. 字符串转整数
3.2.2. 进制转换
3.2.3. 前面补零
3.2.4. NumberFormat 数字格式化
3.3. String 字符串
3.3.1. 查找字符重现的位置
3.3.2. 行数统计
3.3.3. 复制字符串
3.3.4. 随机字符串
3.3.5. 字符串替换处理
3.3.6. substring
3.3.7. string to timestamp
3.3.8. String.strip
3.3.9. 文本块
3.3.10. 分割字符串
3.3.11. 通过 stream() 匹配一组字符串
3.4. 类型转换
3.4.1. Long to String
3.5. Date 日期时间
3.5.1. DateTimeFormatter 格式化日期和时间
3.5.2. SimpleDateFormat 格式化日期和时间
3.5.3. Timestamp
3.5.4. TimeZone
3.5.5. String to Date
3.5.6. 比较两个日期与时间
3.5.7. Calendar
3.5.8. getToday
3.5.9. Yesterday
3.5.10. ISO 8601
3.5.11. LocalDateTime
3.6. Array 数组
3.6.1. 字符串转数组
3.6.2. for each
3.6.3. Array to String
3.6.4. 数据转字符串
3.7. float 浮点
3.8. double 双精度浮点
3.8.1. String to double
3.8.2. 百分数转Double
3.8.3. Double转百分数
3.9. BigDecimal
3.9.1. Convert BigDecimal Object to double value
3.9.2. 去除末尾多余的0
3.9.3. 禁用科学计数法
3.9.4. 移动小数点位置
3.10. StringBuffer
3.11. enum
3.12. byte 类型
3.12.1. string2byte
3.12.2. byte[] to String
3.12.3. BigInteger2byte
3.12.4. int to byte array
3.12.5. byte array to int
3.12.6. byte2char
3.12.7. longToByte64
3.12.8. byte64ToLong
3.12.9. short2byte
3.12.10. byte8ToDouble
3.12.11. byte4ToFloat
3.12.12. 无符号 byte
3.12.13. byte to hex
3.12.14. byte[] to hex
3.12.15. 连接两个 byte[]
3.12.16. List<Byte> to byte[]
3.13. 布尔型 Boolean
4. 流程控制
4.1. Switch
4.1.1. yield
5. 面向对象
5.1. 可变参数
5.2. 泛型
5.2.1.
5.2.2. 数组泛型方法
5.2.3. 静态方法
5.2.4. 可变参数的泛型方法
5.2.5. 返回泛型值
5.2.6. 泛型类
5.3. record
5.4. Callback 回调
5.5. 密封类
5.5.1.
6. 异常处理
6.1. 抛出异常
6.2. try-with-resources
6.3. SneakyThrows
6.3.1. 处理所有异常 Exception
6.3.2. 处理特定异常
6.3.3. 抛出异常
7. Java 线程
7.1. 多线程 Lambda 表达式
7.2. 实现异步执行
7.3. 继承 Thread 类实现多线程
7.3.1. 设置线程名称
7.4. 实现 Runnable 接口
7.5. 线程同步
7.6. ThreadLocal
7.7. ThreadLocalMap
7.8. InheritableThreadLocal
7.9. 守护线程
7.10. 线程等待与线程通知
7.10.1. 通知所有线程
7.10.2. 携带消息
II. JDK Development Kit
8. 数据结构
8.1. Collection 接口
8.2. List
8.2.1. 静态 List
8.2.2. List.of()
8.2.3. List.copyOf()
8.2.4. String[] to List
8.2.5. Stream.toList() 方法
8.2.6. containsAll
8.2.7. stream().allMatch()
8.2.8. 随机 List
8.2.9. getFirst() / getLast()
8.2.10. List 转 Array
8.3. ArrayList
8.3.1. 初始化
8.3.2. 判断元素是否存在
8.3.3. 循环打印
8.3.4. ArrayList to Array
8.3.5. ArrayList to String
8.3.6. Array to List
8.3.7. List to Array
8.3.8. ArrayList forEach
8.3.9. ArrayList stream()
8.3.10. ArrarList 转换为 string[]
8.3.11. string 转换为 ArrayList
8.3.12. ArrayList 转换为 string
8.3.13. string[] 转换为 ArrarList
8.3.14. 合并 List<byte[]> ArrayList<byte[]>
8.4. LinkedList
8.5. Set 转为 List
8.5.1. Set.of()
8.5.2. Set to Array
8.6. Map
8.6.1. 初始化
8.6.2. HashMap
8.6.3. LinkedHashMap
8.6.4. 遍历数据
8.6.5. 迭代器
8.6.6. Map forEach
8.6.7. 随机取值
8.7. Iterator 迭代器
8.7.1. List 迭代
8.7.2. 处理剩余结果
8.7.3. Map 迭代
8.7.4. Iterator 与 List 的区别
8.7.5. remove() 删除操作
8.7.6. Iterable 转 List
8.8. ListIterator
8.9. Queue
8.9.1. 阻塞队列
8.9.2. Deque 双端队列
8.9.3. 数据转换
8.10. Optional
8.10.1. of() 为非null的值创建一个Optional。
8.10.2. ofNullable() 为指定的值创建一个Optional,如果指定的值为null,则返回一个空的Optional。
8.10.3. isPresent 如果值存在返回true,否则返回false。ifEmpty() null 返回 true 否则返回 false
8.10.4. ifPresent() 如果Optional实例有值执行 lambda 表达式
8.10.5. get() 返回值
8.10.6. orElse 如果有值则将其返回,否则返回指定的其它值。
8.10.7. orElseGet与orElse方法类似,区别在于得到的默认值从 Supplier 返回。
8.10.8. orElseThrow 如果有值则将其返回,否则抛出supplier接口创建的异常
8.10.9. map() 方法用来对Optional实例的值执行一系列操作
8.10.10. flatMap()
8.10.11. filter() 通过传入限定条件过滤Optional值
8.10.12. stream()
8.10.13. or()
8.10.14. example
9. 正则表达式
9.1. 正则查找
9.2. 正则替换
9.3. 字符串分割
10. Java 并发编程
10.1. TimeUnit
10.2. AtomicInteger / AtomicLong / AtomicBoolean
10.3. AtomicReference
10.4. ReentrantLock 锁
10.5. 线程安全的 HashMap(ConcurrentHashMap)
10.5.1. 设置键与值
10.6. ArrayBlockingQueue
10.7. Future
10.7.1. Future + Stream 管理一组线程
10.8. FutureTask
10.9. CompletableFuture
10.9.1. runAsync 创建没有返回值的异步任务
10.9.2. supplyAsync 创建带有返回值的异步任务。
10.9.3. 创建 CompletableFuture 实例,并且其他线程中使用
10.9.4. 获取结果
10.9.5. thenRun / thenRunAsync
10.9.6. thenAccept / thenAcceptAsync
10.9.7. thenApply / thenApplyAsync
10.9.8. runAsync / thenAccept / thenApply 区别
10.9.9. whenComplete 任务完成时执行,并且返回结果和异常
10.9.10. 超时处理
10.9.11. 按顺序执行
10.9.12. thenCombine、thenAcceptBoth 和runAfterBoth
10.9.13. applyToEither、acceptEither和runAfterEither
10.9.14. allOf / anyOf
10.9.15. 并行执行 CompletableFuture
10.9.16. 通知完成任务
10.9.17. 异常处理
10.9.18. CompletableFuture 实现 Pipeline 流水线
10.10. java 线程池
10.10.1. newCachedThreadPool
10.10.2. 固定线程池(newFixedThreadPool)
10.10.3. Executors.newScheduledThreadPool
10.10.4. SingleThreadExecutor
10.10.5. ExecutorService 正确关闭方法
10.10.6. ForkJoinPool / ForkJoinTask
10.11. Flow
10.11.1. 自定义 Publisher / Subscriber
10.11.2. SubmissionPublisher
10.11.3. Flow.Processor
10.12. Java 协程
11. Stream
11.1. Stream.of
11.2. Stream.ofNullable
11.3. filter
11.4. map
11.5. limit/skip
11.6. sorted
11.7. distinct
11.8. forEach
11.9. count
11.10. 流转列表
11.11. collect
11.11.1. Collectors.toList() 列表转字符串
11.11.2. Collectors.joining() 连接字符串
11.11.3. 转 Set Collectors.toSet()
11.11.4. Collectors.teeing()
11.12. takeWhile 和 dropWhile
11.13. 合并 Stream
11.14. mapToObj
11.15. 混合使用的例子
11.15.1. List to Stream
11.16. 流复用 streamSupplier
11.17. Parallel Streams(并行流)
11.18. IntStream / LongStream / DoubleStream
12. 函数式编程
12.1. Supplier 供应型的接口
12.1.1. Supplier 作为方法参数使用
12.2. IntSupplier / LongSupplier / DoubleSupplier / BooleanSupplier
12.3. Consumer 消费型的接口
12.4. IntConsumer
12.5. BiConsumer
12.6. BiFunction
12.7. Predicate 判断型的接口
12.8. Supplier / Consumer / Predicate 应用场景
13. Util
13.1. Properties 处理 *.properties 文件
13.1.1. 打开 properties 文件
13.1.2. propertyNames()
13.1.3. keySet()
13.1.4. entrySet()
13.1.5. 方法中返回 Properties
13.1.6.
13.1.7. getResourceAsStream()
13.1.8. store
13.1.9. 实现国际化
13.2. Logging
13.2.1. console
13.3. BASE64
13.4. Locale 国际化
13.5. ResourceBundle
13.6. Scanner
13.7. UUID
13.8. Arrays.equals 判断两个数组是否相等
13.9. Random 随机字符串
13.9.1. 取 0-n 范围内随机数
13.9.2. 指定随机数范围
13.10. CRC32
13.11. Timer / TimerTask 实现周期性重复执行
14. 时间
14.1. LocalDate
14.2. LocalTime
14.3. ZonedDateTime
14.4. DateTimeFormatter
14.5. Instant
14.6. Period :基于日期值
14.7. Duration:基于时间值
14.7.1. 设置指定单位的持续时间
14.7.2. 获取指定单位的持续时间
14.7.3. 获取两个时间点之间差值的持续时间
14.7.4. 获取毫秒
15. IO
15.1. 取出文件名中的扩展名
15.1.1. getAbsolutePath() 获取绝对路径
15.1.2. 创建目录 mkdir()
15.2. 临时文件
15.3. FileWriter 文本写入文件
15.4. BufferedWriter
15.5. inputStream.transferTo()
15.6. InputStreamReader
15.7. 获得 Resource 下文件路径
15.8. PrintWriter
15.9. OutputStreamWriter
15.10. FileOutputStream
15.11. FileInputStream
15.12. Scanner
15.13. 二进制文件
15.13.1. 理解二进制文件
15.13.2. byte 类型
15.13.3. boolean 布尔型
15.13.4. Long 型
15.13.5. char 类型
15.13.6. UTF 字符串
15.13.7. Short 类型
15.13.8. float 单精度浮点类型
15.13.9. double 数据类型
15.13.10. 二进制文件操作演示
16. Network
16.1. URL
16.2. 获取IP地址何机器名
17. JDBC
17.1. 安装 JDBC 包
17.2. MySQL
17.3. Oracle
17.3.1. SID
17.3.2. SERVICE_NAME
17.3.3. TNS
17.3.4. Oracle RAC Cluster
17.3.5. Oracle JDBC Demo
17.4. FAQ
17.4.1. java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
17.4.2. Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
18. Reflection 反射
18.1. 获得所有变量
18.2. 批量赋值
18.3. 方法操作
18.3.1. 获得所有方法
18.3.2. set/get 方法
18.3.3. static 方法调用
18.4. 完成的例子
19. java.security
19.1. 列出 Java 支持的数字摘要算法
19.2. 计算文件的 MD5,SHA 等 HASH 值
20. javax
20.1. java 脚本引擎
20.1.1. Maven
20.1.2. Helloworld
20.1.3. 运行脚本文件
20.1.4. 变量传递
20.1.5. 全局变量与局部变量定义
20.1.6. 调用脚本中的函数或方法
20.1.7. 脚本编译
20.1.8. jjs - Invokes the Nashorn engine.
20.2. Crypto
20.2.1. MD5
20.2.2. AES
20.2.3. AES/CBC/PKCS5PADDING
20.2.4. DES
III. Build Tools
21. Apache Ant
21.1. 安装 ant
21.1.1. 1.8
21.1.2. 1.10.1
21.2. ANT
21.2.1. ant.project.name
21.2.2. 定义
21.3. Project
21.3.1. property
21.3.2. ant
21.3.3. environment
21.4. path
21.5. copy
21.6. javac
21.7. condition
21.8. exec
21.8.1. sshexec
21.9. if
21.10. macrodef
21.10.1. Git
21.10.2. Rsync
21.10.3. SSH
21.10.4. maven
21.11. Javascript
21.12. mail
21.13. basename
21.14. 创建文件
21.15. FAQ
21.15.1. warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
21.15.2. 调试 exec
22. Apache Ivy
22.1. Ivy Install
22.1.1. source code
22.1.2. apt-get
22.2. Test example
23. Apache Maven
23.1. 安装 Maven
23.1.1. CentOS 8 安装 Maven
23.1.2. Ubuntu
23.1.3. 一键安装
23.1.4. apache-maven-3.8.2
23.1.5. Nexus Repository OSS
23.1.6. mvnd
23.2. Maven 命令
23.2.1. 切换 JAVA 版本
23.2.2. 参数
23.2.3. -s 指定 settings.xml 文件
23.2.4. 多线程
23.2.5. help
23.2.6. archetype:create
23.2.7. clean
23.2.8. compile
23.2.9. 编译测试代码
23.2.10. test
23.2.11. package
23.2.12. install
23.2.13. war
23.2.14. exec
23.2.15. dependency
23.2.16. jar
23.2.17. 构建装配Maven Assembly
23.2.18. 加密密码
23.2.19. help:describe
23.3. settings.xml 配置
23.3.1. Maven 仓库
23.3.2. 镜像配置
23.4. pom.xml
23.4.1. properties
23.4.2. 常用的POM属性
23.4.3. repositories 仓库配置
23.4.4. dependencies
23.4.5. dependencyManagement
23.4.6. build
23.4.7. plugins
23.5. Maven Module
23.5.1. Parent
23.5.2. 公共项目 common
23.5.3. 常规项目
23.5.4. 现在测试效果
23.6. 依赖管理
23.6.1. 创建依赖模块
23.6.2. 引用依赖管理
23.7. plugins
23.7.1. maven-compiler-plugin
23.7.2. maven-war-plugin
23.7.3. maven-antrun-plugin
23.7.4. maven-install-plugin
23.7.5. maven-surefire-plugin
23.7.6. maven-deploy-plugin
23.7.7. maven-jar-plugin
23.7.8. maven-dependency-plugin
23.7.9. spring-boot-maven-plugin
23.7.10. tomcat8-maven-plugin
23.7.11. docker-maven-plugin
23.8. 应用案例
23.8.1. 并行开发解决不同环境包引用
24. Gradle 5
24.1. 安装 Gradle
24.1.1. CentOS
24.1.2. Mac
24.1.3. Artifactory 本地仓库
24.2. Example
24.3. gradle 命令
24.3.1. tasks 列出任务
24.4. build.gradle
24.4.1. repositories
24.4.2. dependencies
24.4.3. jar
24.4.4. Task
24.5. gradle.properties
24.5.1. 列出 properties
24.5.2. 自定义 gradle.properties
24.5.3. ext
24.5.4. System.properties
25. JitPack - Easy to use package repository for Git
IV. Spring Boot
26. Spring Boot Quick start
26.1. 创建项目
26.2. pom.xml
26.3. Controller
26.4. Springboot with Maven
26.4.1. resource
26.4.2. Maven run
26.4.3. Spring Boot maven 插件 build-image
26.4.4. 生成项目信息
27. Spring 开发环境
27.1. Java 开发环境
27.2. 安装 Spring Tool Suite
27.3. Dashboard
27.4. Spring Initializr - Bootstrap your application
28. SpringApplication
28.1. 运行 Spring boot 项目
28.1.1. Linux systemd
28.1.2. 传统 init.d 脚本
28.1.3. 编译用于Tomcat的 War
28.2. @SpringBootApplication
28.2.1. 排除 @EnableAutoConfiguration 加载项
28.3. 获取 Resources 目录中的静态文件
28.4. @EnableAutoConfiguration
28.5. @ComponentScan
28.6. @EntityScan 实体扫描
28.7. @EnableJpaRepositories
28.8. 启动和销毁
28.9. 打印环境变量
28.10. CharacterEncodingFilter
28.11. 隐藏 Banner
28.12. 实体与仓库扫描
28.13. 列出 Beans
28.14. Tomcat 端口
28.15. 配置项设定
28.16. spring.profiles.active
28.17. @Profile("dev") / @ActiveProfiles("dev")
28.18. 设置默认时区
29. 如何优雅停止 Springboot 运行
29.1. 准备工作
29.2. kill 命令演示
29.3. 容器中如何优雅关闭 Springboot
29.4. 写入PID文件
30. Properties 配置文件
30.1. application.properties 配置文件
30.1.1. application.properties 参考
30.1.2. 启动指定参数
30.1.3. 加载排除
30.1.4. PID FILE
30.1.5. banner 关闭
30.1.6. server
30.1.7. logging
30.1.8. 内嵌 tomcat server
30.1.9. servlet
30.1.10. JSON 输出与日期格式化
30.1.11. SMTP 相关配置
30.1.12. Redis
30.1.13. MongoDB
30.1.14. MySQL
30.1.15. Oracle
30.1.16. default_schema
30.1.17. datasource
30.1.18. velocity
30.1.19. Security 相关配置
30.1.20. MVC 配置
30.1.21. Kafka 相关配置
30.2. Properties 文件
30.2.1. @Value 注解
30.2.2. @EnableConfigurationProperties 引用自定义 *.properties 配置文件
30.2.3. @PropertySource 注解载入 properties 文件
30.3. Environment 读取配置文件
30.4. 手工载入 *.properties 文件
30.5. 命令行注入配置项
30.5.1. spring.profiles.active 参数切换配置文件
30.5.2. SpringApplicationBuilder.properties() 方法添加配置项
30.5.3. 禁用命令行注入环境变量
30.6.
30.7. PropertyResolver 获取配置
30.8. 参数引用
30.9. 默认值
30.10. 产生随机数
30.10.1. 随机数
30.11. 多行字符串
30.12. 注入多值属性 arrays, list, set
30.13. List 列表类型
30.14. Map类型
30.15. Binder
30.16. 加密 application.properties 中的敏感内容
31. Spring boot with Logging
31.1. 配置日志文件
31.1.1. 日志输出级别
31.1.2. Spring boot 2.1 以后的版本不打印 Mapped 日志问题
31.1.3. 禁止控制台输出日志
31.1.4. 定制日志格式
31.1.5. 彩色输出
31.2. 打印日志
31.2.1. lombok
31.3. logback 配置详解
31.3.1. 标准输出
31.3.2. 禁止 logback 日志输出
31.3.3. 指定Class过滤日志
31.3.4. configuration 属性配置
31.3.5. contextName 设置上下文名称
31.3.6. property 设置变量
31.3.7. encoder 日志格式设置
31.3.8. RollingFileAppender
31.3.9. 日志过滤
31.3.10. 标准输出
31.3.11. MDC
31.3.12. 日志写入 MongoDB
31.3.13. 日志发送给 logstash
31.3.14. fluentd
31.3.15. Loki4j Logback
31.4. Log4j2 + Gelf + Logstash
31.4.1. Maven 配置
31.4.2. log4j2.xml 配置
31.4.3. Java 测试代码
31.4.4. Logstash 配置
31.4.5. 测试结果
31.4.6. Log4j2 更多技巧
31.5. 日志报警
31.5.1. Logstash 配置
31.5.2. 监控 SpringBootApplication 的启动和退出
31.6. Spring boot with ELK(Elasticsearch + Logstash + Kibana)
31.6.1. TCP 方案
31.6.2. Redis 方案
31.6.3. Kafka 方案
31.6.4. Other
32. Spring boot with Undertow
32.1. Maven 依赖
32.2. Application
32.3. 相关配置
33. Spring boot with Jetty
34. Spring boot with HTTP2 SSL
34.1. 生成自签名证书
34.2. application.properties 配置文件
34.3. 启动 Spring boot
34.4. restTemplate 调用实例
34.5. HTTP2
35. Spring boot with MongoDB
35.1. Maven
35.2. Application
35.3. MongoTemplate
35.4. Repository
36. Spring boot with MySQL
36.1. Maven
36.2. Resource
36.3. Application
36.4. JdbcTemplate
36.5. CrudRepository
37. Spring boot with Oracle
37.1. Maven
37.2. application.properties
37.3. Application
37.4. CrudRepository
37.5. JdbcTemplate
37.6. Controller
38. Spring boot with PostgreSQL
38.1. pom.xml
38.2. application.properties
38.3. Application
38.4. CrudRepository
38.5. JdbcTemplate
38.6. Controller
38.7. Test
39. Spring boot with Elasticsearch
39.1. Maven
39.2. Application
39.3. application.properties
39.4. Domain
39.5. ElasticsearchRepository
40. Spring boot with Elasticsearch TransportClient
40.1. Maven
40.2. Application
40.3. application.properties
40.4. ElasticsearchConfiguration
40.5. RestController
41. Spring boot with Apache Hive
41.1. Maven
41.2. application.properties
41.3. Configuration
41.4. CURD 操作实例
42. Spring boot with Phoenix
42.1. Maven
42.2. application.properties
42.3. Configuration
43. Spring boot with Datasource
43.1. Master / Slave 主从数据库数据源配置
43.1.1. application.properties
43.1.2. 配置主从数据源
43.1.3. 选择数据源
43.2. 多数据源配置
43.3. JPA 多数据源
44. 连接池配置
44.1. org.apache.tomcat.jdbc.pool.DataSource
44.2. druid
44.2.1. 加密数据库密码
44.3. c3p0 - JDBC3 Connection and Statement Pooling
44.4. dbcp2
44.5. bonecp
44.6. HikariPool
45. Spring boot with Queue
45.1. Spring boot with RabbitMQ(AMQP)
45.1.1. maven
45.1.2. RabbitMQConfig
45.1.3. 生产者
45.1.4. 消费者
45.2. Spring boot with Apache Kafka
45.2.1. 安装 kafka
45.2.2. maven
45.2.3. Spring boot Application
45.2.4. EnableKafka
45.2.5. KafkaListener
45.2.6. 测试
45.2.7. 完整的发布订阅实例
45.2.8. Spring cloud with Kafka
46. Spring boot with Scheduling
46.1. 启用计划任务
46.1.1. Application.java
46.1.2. 配置
46.1.3. Component
46.2. 计划任务控制开关
46.3. @Scheduled 详解
46.3.1. fixedRate 案例
46.3.2. timeUnit
46.4. cron 表达式
46.4.1. 每3秒钟一运行一次
46.4.2. 凌晨23点运行
46.4.3. 周一 ~ 周五
46.5. Timer 例子
46.6. ScheduledExecutorService 例子
47. Spring boot with Swagger
47.1. Spring boot with Springdoc
47.1.1. WebMvc
47.1.2. Webflux
47.1.3. Swagger UI
47.1.4. 从 SpringFox 迁移到 Swagger3 注解变化
47.2. Spring boot with knife4j
47.2.1. maven
47.2.2. Knife4jConfiguration
47.2.3. application.properties
47.3. springfox
47.3.1. Swagger3
47.3.2. Swagger2
47.3.3. @Api() 资源定义
47.3.4. @ApiIgnore 忽律接口
47.3.5. @ApiOperation()
47.3.6. @ApiResponses
47.3.7. @ApiModel 实体类
48. Spring boot with lombok
48.1. @Builder
48.2. @Slf4j 注解
49. Spring boot with Container
49.1. Spring boot with Docker
49.1.1. 通过 Docker 命令构建镜像
49.1.2. 通过 Maven 构建 Docker 镜像
49.1.3. [ERROR] No plugin found for prefix 'dockerfile' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/Users/neo/.m2/repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
49.1.4. curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:8888
49.2. Spring boot with Docker stack
49.2.1. 编译 Docker 镜像
49.2.2.
49.3. Spring boot with Kubernetes
49.3.1. Kubernetes 编排脚本
49.3.2. 部署镜像
50. Spring boot with command line
50.1. Maven
50.2. CommandLineRunner 例子
50.3. ApplicationRunner 例子
51. Spring Boot Actuator
51.1. Maven 依赖
51.2. 与 Spring Boot Actuator 有关的配置
51.2.1. 禁用HTTP端点
51.2.2. 安全配置
51.2.3. 修改 actuator 地址
51.2.4. 关机
51.3. actuator 接口
51.4. 健康状态
51.4.1. 健康状态
51.5. info 配置信息
51.6. beans 信息
51.7. caches
51.8. conditions
51.9. configprops 配置文件
51.10. env 环境变量
51.11. logfile 日志
51.12. threaddump 线程信息
51.13. 计划任务
51.14. metrics
51.15. 控制器映射 URL
51.16. 自定义监控指标
52. SpringBootTest
52.1. Maven 依赖
52.2. 测试类
52.2.1. Junit基本注解介绍
52.3.
52.3.1. Assert.assertEquals 判断相等
52.3.2. Assert.assertTrue
52.4. JPA 测试
52.5. TestRestTemplate
52.6. Controller单元测试
52.7. WebTestClient
53. Spring boot with Aop
53.1. Aspect
53.1.1. Maven
53.1.2. Pojo 类
53.1.3. Service 类
53.1.4. Aspect 类
53.1.5. 控制器
53.1.6. Application
53.1.7. 测试
54. Spring boot with starter
54.1. 实现 starter
54.1.1. Maven pom.xml 依赖包
54.1.2. 配置文件处理
54.1.3. 自动配置文件
54.1.4. 启用 starter 的自定义注解
54.2. 引用 starter
54.2.1. Maven pom.xml 引入依赖
54.2.2. 通过注解配置 starter
54.2.3. 测试运行结果
55. Spring boot with Monitor
55.1. Spring boot with Grafana
55.1.1. Springboot 集成 InfluxDB
55.1.2. InfluxDB
55.2. Spring Boot with Prometheus
55.2.1. Maven 依赖
55.2.2. application.properties 配置文件
55.2.3. 启动类
55.2.4. 测试
55.2.5. 控制器监控
55.2.6. 自定义埋点监控
57. Spring boot with Git version
57.1. CommonRestController 公共控制器
57.2. VersionRestController 测试控制器
57.3. 创建 .gitattributes 文件
58. Spring boot with Session share
58.1. Redis
58.1.1. Maven
58.1.2. application.properties
58.1.3. Application
58.2. 测试 Session
58.3. JDBC
58.4. Springboot 2.1
59. Spring boot with Caching
59.1. maven
59.1.1. Redis
59.2. 启用 Cache
59.3. @Cacheable 的用法
59.3.1. SpEL表达式
59.3.2. 排除 null 结果
59.3.3. 排除 empty
59.4. @CachePut 用法
59.5. 清空缓存
59.6. @Caching
59.7. 解决Expire 和 TTL 过期时间
60. Spring boot with Email
60.1. Maven
60.2. Resource
60.3. POJO
60.4. RestController
60.5. Test
61. Spring boot with Hessian
61.1. Maven
61.2. Application
61.3. HessianServiceExporter
61.4. Service
61.5. RestController
62. Spring boot with Async
62.1. Callable 实现异步
62.2. WebAsyncTask 实现异步
62.3. DeferredResult 实现异步返回结果
62.4. 带有返回值的异步任务
62.4.1. Future
62.4.2. CompletableFuture
62.5. 默认简单线程池 SimpleAsyncTaskExecutor
62.5.1. 配置线程池
62.5.2. @Service/@Component 中异步执行
62.5.3. applicationTaskExecutor
62.6. ThreadPoolTaskExecutor 自定义线程池
62.6.1. 最简单的配置
62.6.2. 队列
62.6.3. 定义多个线程池
62.6.4. 实现 AsyncConfigurer 接口方式创建自定义连接池
62.6.5. 继承 AsyncConfigurerSupport 创建自定义连接池
62.6.6. 生产环境完整代码 @Bean 注入方式
62.6.7. 通过 @Bean 覆盖掉 SimpleAsyncTaskExecutor
62.7. 自定义线程池 ThreadPoolExecutor
62.7.1. ThreadPoolExecutor
62.7.2. 注入自定义线程池bean
62.8. 设置线程名称
62.9. 线程池监控
62.10. 注意事项
63. Springboot with Ethereum (web3j)
63.1. Maven
63.2. application.properties
63.3. TestRestController
63.4. 测试
64. Java Record 新特性
64.1. Record 替代 POJO 类
64.2. Record 作为 Properties
64.3. Record 作为实体类
64.4. Record 作为 Service
64.5. Record 作为 Controller
V. Spring Framework
65. Spring 框架
65.1. @Bean
65.1.1. @Scope 定义类型
65.1.2. InitializingBean
65.2. URL 拼装/解析
65.3. ServletUriComponentsBuilder
65.4. URL 路径相关
66. Spring MVC
66.1. @EnableWebMvc
66.1.1. CORS 跨域请求
66.1.2. Spring MVC CORS with WebMvcConfigurerAdapter
66.2. @Controller
66.2.1. @RequestMapping
66.2.2. @GetMapping
66.2.3. @PostMapping
66.2.4. @RequestBody
66.2.5. RequestMapping with Request Parameters - @RequestParam
66.2.6. @RequestHeader - 获取 HTTP Header 信息
66.2.7. RequestMapping with Path Variables - @PathVariable
66.2.8. @MatrixVariable注解,RFC3986定义URI的路径(Path)中可包含name-value片段
66.2.9. @ModelAttribute
66.2.10. @ResponseBody
66.2.11. @ResponseStatus 设置 HTTP 状态
66.2.12. @CrossOrigin
66.2.13. @CookieValue - 获取 Cookie 值
66.2.14. @SessionAttributes
66.2.15. ModelAndView
66.2.16. HttpServletRequest / HttpServletResponse
66.2.17. StreamingResponseBody 输出 Raw Data
66.3. @RestController
66.3.1. 上传文件
66.3.2. 返回实体
66.3.3. JSON
66.3.4. 处理原始 RAW JSON 数据
66.3.5. 返回 JSON 对象 NULL 专为 "" 字符串
66.3.6. XML
66.3.7. 兼容传统 json 接口
66.3.8. 上传文件
66.3.9. Spring boot with csv
66.3.10. Json 处理
66.3.11. synchronized
66.3.12. SSE Streaming in Spring MVC
66.3.13. StreamingResponseBody
66.4. View
66.4.1. 配置静态文件目录
66.4.2. 添加静态文件目录
66.4.3. Using Spring’s form tag library
66.4.4. Thymeleaf
66.4.5. FreeMarker
66.4.6. i18n 国际化
66.5. 校验器(Validator)
66.5.1. 常规用法
66.5.2. 自定义注解
66.6. Interceptor/Filter 拦截器/过滤
66.6.1. Session 拦截
66.6.2. Token 拦截
66.6.3. 过滤器
66.6.4. 拦截器获取PathVariable变量
66.7. String boot with RestTemplate
66.7.1. RestTemplate Example
66.7.2. GET 操作
66.7.3. POST 操作
66.7.4. PUT 操作
66.7.5. Delete 操作
66.7.6. 上传文件
66.7.7. HTTP Auth
66.7.8. PKCS12
66.7.9. Timeout 超时设置
66.8. RestClient
66.8.1. 创建 RestClient
66.8.2. Get 操作
66.8.3. Post Json
66.8.4. HTTP Authorization Basic
66.8.5. onStatus
66.8.6. 下载二进制流
68. WebFlux framework
68.1. Getting Started
68.1.1. Maven
68.1.2. Application
68.1.3. RestController
68.1.4. 测试
68.2. WebFlux 与 SprintMVC 有什么不同?
68.2.1. 实验程序
68.2.2. 实验结果
68.3. WebFlux Router
68.3.1. Component 原件
68.3.2. 路由配置
68.4. RestController
68.4.1. Post 数据
68.4.2. Thymeleaf
68.5. Webflux Redis
68.5.1. Maven Redis 依赖
68.5.2. Redis 配置
68.5.3. Config
68.5.4. Service
68.5.5.
68.6. Webflux Mongdb
68.6.1. Maven 依赖
68.6.2. Repository
68.6.3. Service
68.6.4. 控制器
68.7. Mono
68.7.1. Mono.just()/Mono.justOrEmpty()
68.7.2. MonoSink 创建 Mono
68.7.3. Supplier 创建 Mono
68.7.4. then()
68.7.5. 异常处理
68.7.6. 同步阻塞等待结果
68.8. Flux 返回多条数据
68.8.1. FluxSink 创建异步 Flux
68.8.2. SynchronousSink 创建同步 Flux
68.8.3. just()
68.8.4. 从 Flux/Mono 创建 Flux
68.8.5. 消息订阅
68.8.6. 从 Flux/Mono 创建 Flux
68.8.7. 从 Iterable 创建 Flux
68.8.8. 从 Stream 创建 Flux
68.8.9. defer()
68.8.10. Flux.interval()
68.8.11. Flux.empty()
68.8.12. Flux.error()
68.8.13. Flux.never()
68.8.14. Flux.range()
68.8.15. 返回数据
68.8.16. 持续更新 Flux
68.8.17. map(), flatMap()
68.8.18. 过滤
68.8.19. 触发操作
68.9. SSE
68.9.1. 一次性事件
68.9.2. 从 Steam 返回数据
68.9.3. 周期性事件
68.9.4. 返回 ServerSentEvent 数据结构
68.9.5. SSE 完整的例子
68.9.6. SSE Client 订阅实例
68.10. 并发
68.11. ConnectableFlux
68.12. WebClient
68.12.1. 配置 WebClient
68.12.2. @Controller/@RestController 实例
68.12.3. Get 请求实例
68.12.4. URI 参数
68.12.5. 查询参数
68.12.6. Post 操作演示
68.12.7. Post 表单数据
68.12.8. 上传文件
68.12.9. 设置 HTTP 头
68.12.10. 同步阻塞等待返回结果
68.12.11. websocket
68.12.12. 获取 HTTP 链接状态
68.12.13. Http Base Authentication - 401 Unauthorized
68.12.14. 订阅 SSE
68.12.15. 超时时间
68.12.16. share() 共享订阅数据
68.12.17. 打印调试日志
68.13. Webflux 安全
68.13.1. Token 拦截器
68.13.2. JWT
68.13.3. spring-boot-starter-security
68.14. 常见问题
68.14.1. The Java/XML config for Spring MVC and Spring WebFlux cannot both be enabled, e.g. via @EnableWebMvc and @EnableWebFlux, in the same application.
68.14.2. @EnableWebFluxSecurity 与 @EnableReactiveMethodSecurity 不生效
68.14.3. webflux netty 不支持 Content-Type: application/x-www-form-urlencoded
69. Service
69.1. Application
69.2. 定义接口
69.3. 实现接口
69.4. 调用 Service
69.5. context.getBean 调用 Service
69.6. AopContext
69.7. Service 单例/多例模式
69.7.1. Service 是单例模式
69.7.2. Service 多例实现
69.8. 构造方法
70. Spring boot with Webpage
70.1. Maven
70.2. application.properties
70.3. Application
70.4. IndexController
70.5. src/main/webapp/WEB-INF/jsp/index.jsp
70.6. 集成模板引擎
71. Spring boot with Velocity template
71.1. Maven
71.2. Resource
71.3. Application
71.4. RestController
71.5. Test
72. Spring boot with Thymeleaf
72.1. Maven
72.2. application.properties
72.3. Controller
72.4. HTML5 Template
73. Tomcat Spring 运行环境
73.1. Maven
73.2. Spring MVC configuration
73.3. Tomcat
73.4. 集成 Mybatis
73.4.1. pom.xml
73.4.2. properties
73.4.3. dataSource
73.4.4. SqlSessionFactory
73.4.5. Mapper 扫描
73.4.6. Mapper 单一class映射
73.4.7. Service
73.4.8. 测试实例
VI. Spring Data
74. EntityManager
75. Spring Data with JdbcTemplate
75.1. execute
75.2. queryForInt
75.3. queryForLong
75.4. queryForObject
75.4.1. 返回整形与字符型
75.4.2. 查询 Double 类型数据库
75.4.3. 返回日期
75.4.4. 返回结果集
75.4.5. 通过 "?" 向SQL传递参数
75.4.6. RowMapper 记录映射
75.5. queryForList
75.5.1. Iterator 用法
75.5.2. for 循环
75.5.3. forEach 用法
75.6. queryForMap
75.7. query
75.7.1. ResultSet
75.7.2. ResultSetExtractor
75.7.3. RowMapper
75.8. queryForRowSet
75.9. update
75.10. MapSqlParameterSource
75.11. 实例参考
75.11.1. 参数传递技巧
76. Spring Data with MySQL
76.1. 选择数据库表引擎
76.2. 声明实体
76.2.1. @Entity 声明实体
76.2.2. @Table 定义表名
76.2.3. @Id 定义主键
76.2.4. @Column 定义字段:
76.2.5. 非数据库字段
76.2.6. @Lob 注解属性将被持久化为 Blog 或 Clob 类型
76.2.7. @NotNull 不能为空声明
76.2.8. @Temporal 日期定义
76.2.9. 创建日期
76.2.10. @DateTimeFormat 处理日期时间格式
76.2.11. Enum 枚举数据类型
76.2.12. SET 数据结构
76.2.13. JSON 数据类型
76.2.14. 索引
76.2.15. 嵌入
76.2.16. 外键
76.2.17. 映射集合属性
76.2.18. @JsonIgnore
76.2.19. @EnableJpaAuditing 开启 JPA 审计功能
76.2.20. 注释 @Comment
76.2.21. @Pattern 数据匹配
76.2.22. 实体继承
76.3. Repository
76.3.1. CrudRepository
76.3.2. JpaRepository
76.3.3. PagingAndSortingRepository
76.3.4. findByXXX
76.3.5. count 操作
76.3.6. delete 删除操作
76.3.7. OrderBy
76.3.8. GreaterThan
76.3.9. Sort 排序操作操作
76.3.10. Pageable 翻页操作
76.3.11. @DynamicInsert 与 @DynamicUpdate
76.3.12. 继承已存在的 Repository
76.3.13. 自定义返回字段
76.4. TransactionTemplate
76.5. JPQL @Query
76.5.1. @Modifying 更新/删除
76.5.2. 事务 @Transactional
76.5.3. 参数传递
76.5.4. 原生 SQL 操作
76.5.5. @Query 与 Pageagble
76.5.6. 返回指定字段
76.5.7. 返回指定的模型
76.5.8. Collection
76.5.9. Sort
76.5.10. 锁 @Lock
77. Spring Data with Redis
77.1. 集成 Redis XML 方式
77.1.1. pom.xml
77.1.2. springframework-servlet.xml
77.1.3. Controller
77.1.4. index.jsp
77.1.5. 测试
77.2. 通过构造方法实例化 Redis
77.3. RedisTemplate
77.3.1. 设置缓存时间
77.3.2. increment
77.3.3. 删除 key
77.3.4. 对象存储
77.3.5. 获取过期时间
77.3.6. 过期时间未执行
77.4. stringRedisTemplate 基本用法
77.5. ValueOperations
77.5.1. 字符串截取
77.5.2. 追加字符串
77.5.3. 设置键的字符串值并返回其旧值
77.5.4. 返回字符串长度
77.5.5. 如果key不存便缓存。
77.5.6. 缓存多个值 /获取多个值 multiSet / multiGet
77.5.7. setBit / getBit 二进制位操作
77.6. 列表操作
77.6.1. rightPush
77.6.2. rightPushAll
77.6.3. rightPushIfPresent
77.6.4. leftPush
77.6.5. leftPushAll
77.6.6. range
77.7. SetOperations 数据类型
77.7.1. 返回集合中的所有成员
77.7.2. 取出一个成员
77.7.3. 随机获取无序集合中的一个元素
77.7.4. 随机获取 n 个成员(存在重复数据)
77.7.5. 随机获取 n 个不重复成员
77.7.6. 在两个 SET 间移动数据
77.7.7. 成员删除
77.7.8. 返回集合数量
77.7.9. 判断元素是否在集合成员中
77.7.10. 对比两个集合求交集
77.7.11. 对比两个集合求交集,然后存储到新的 key 中
77.7.12. 合并两个集合,并去处重复数据
77.7.13. 合并两个集合去重复后保存到新的 key 中
77.7.14. 计算两个合集的差集
77.7.15. 计算两个合集的差集,然后保存到新的 key 中
77.7.16. 遍历 SET 集合
77.8. ZSetOperations 有序的 set 集合
77.9. HashOperations
77.9.1. put
77.9.2. putAll
77.9.3. 从键中的哈希获取给定hashKey的值
77.9.4. delete
77.9.5. 确定哈希hashKey是否存在
77.9.6. 从哈希中获取指定的多个 hashKey 的值
77.9.7. 只有hashKey不存在时才能添加值
77.9.8. 获取整个Hash
77.9.9. 获取所有key
77.9.10. 通过 hashKey 获取所有值
77.9.11. 值加法操作
77.9.12. 遍历 Hash 表
77.10. 存储 Json 对象
77.10.1. 集成 RedisTemplate 定义新类 JsonRedisTemplate
77.10.2. 配置 Redis
77.10.3. 测试
77.11. Spring Data Redis - Repository Examples
77.11.1. @EnableRedisRepositories 启动 Redis 仓库
77.11.2. 定义 Domain 类
77.11.3. Repository 接口
77.11.4. 测试代码
78. Spring Data with MongoDB
78.1. Example Spring Data MongoDB
78.1.1. pom.xml
78.1.2. springframework-servlet.xml
78.1.3. POJO
78.1.4. Controller
78.1.5. 查看测试结果
78.1.6. 条件查询
78.2. MongoDB 多数据源
78.2.1. Maven
78.2.2. Application 禁止自动配置 MongoDB
78.2.3. application.properties 新增配置项
78.2.4. MongoDB 配置类
78.2.5. 创建 Document 关系映射类
78.2.6. 测试控制器
78.2.7. 测试
78.3. @Document
78.3.1. 指定表名
78.3.2. @Id
78.3.3. @Version
78.3.4. @Field 定义字段名
78.3.5. @Indexed
78.3.6. @CompoundIndex 复合索引
78.3.7. @TextIndexed
78.3.8. @GeoSpatialIndex 地理位置索引
78.3.9. @Transient 丢弃数据,不存到 mongodb
78.3.10. @DBRef 做外外键引用
78.3.11. @DateTimeFormat
78.3.12. @NumberFormat
78.3.13. 在 @Document 中使用 Enum 类型
78.3.14. 在 @Document 中定义数据结构 List/Map
78.3.15. GeoJson 数据类型
78.4. MongoRepository
78.4.1. 扫描仓库接口
78.4.2. findAll()
78.4.3. deleteAll()
78.4.4. save()
78.4.5. count()
78.4.6. exists() 判断是否存在
78.4.7. existsById()
78.4.8. findByXXXX
78.4.9. findAll with OrderBy
78.4.10. findAll with Sort
78.4.11. FindAll with Pageable
78.4.12. StartingWith 和 EndingWith
78.4.13. Between
78.4.14. Before / After
78.4.15. @Query
78.5. mongoTemplate
78.5.1. Save 保存
78.5.2. Insert
78.5.3. updateFirst 修改符合条件第一条记录
78.5.4. updateMulti 修改符合条件的所有
78.5.5. 查找并保存
78.5.6. upsert - 修改符合条件时如果不存在则添加
78.5.7. 删除
78.5.8. 查找一条数据
78.5.9. 查找所有数据
78.5.10. Query
78.5.11. Criteria
78.5.12. Update
78.5.13. BasicUpdate
78.5.14. Sort
78.5.15. Query + PageRequest
78.5.16. newAggregation
78.5.17. 创建索引
78.5.18. 子对象操作
78.6. GeoJson 反序列化
78.7. FAQ
78.7.1. location object expected, location array not in correct format; nested exception is com.mongodb.MongoWriteException: location object expected, location array not in correct format
79. Spring Data with Elasticsearch
79.1. 内嵌 Elasticsearch
79.1.1. Maven
79.1.2. src/main/resources/application.properties
79.1.3. Domain Class
79.1.4. ElasticsearchRepository
79.1.5. SearchRestController
79.1.6. 测试
79.2. 集群模式
79.3. Document
79.4. Elasticsearch 删除操作
79.5. FAQ
79.5.1. java.lang.IllegalStateException: Received message from unsupported version: [2.0.0] minimal compatible version is: [5.0.0]
80. Spring boot with Data restful
80.1. Maven
81. Apache ShardingSphere
81.1. 微服务集群环境,雪花算法出现重复ID
81.1.1. 方案一、配置实现
81.1.2. 方案二、代码实现
VII. Spring Security
82. Springboot 3 + Security 6
82.1. Spring Security with HTTP Auth
82.1.1. 默认配置
82.1.2. 设置用户名和密码
82.1.3. 禁用 Security
82.1.4. 设置角色
82.2. Springboot 3 Security + OncePerRequestFilter
82.2.1. OncePerRequestFilter
82.2.2. SecurityConfiguration
82.3. SecurityFilterChain
82.4. @PreAuthorize
82.4.1. hasRole
82.4.2. hasAnyRole
82.4.3. 从 HttpServletRequest 返回的 request 变量中判断角色
82.4.4. getAuthentication() 获得角色
82.4.5. UserDetailsService
82.5. httpBasic 配置
82.6.
83. Spring Authorization Server
83.1. Oauth2 协议
83.1.1. token
83.1.2. grant_type
83.1.3. 授权码授权模式(Authorization Code Grant)
83.1.4. 密码模式(Resource Owner Password Credentials Grant)
83.1.5. 客户端凭证模式(Client Credentials Grant)
83.1.6. 刷新 TOKEN 方式
83.2. Maven 依赖
83.3. Spring cloud with Oauth2
83.3.1. authorization_code
83.3.2. Spring boot with Oauth2 - Password
83.3.3. Spring boot with Oauth2 jwt
83.3.4. Spring boot with Oauth2 jwt 非对称证书
83.3.5. Apple iOS 访问 Oauth2
83.3.6. Oauth2 客户端
83.3.7. Android Oauth2 + Jwt example
83.3.8. RestTemplate 使用 HttpClient
83.3.9. 自签名证书信任问题
83.3.10. Principal
83.3.11. SecurityContextHolder 对象
83.3.12. 资源服务器配置
83.3.13. Client
83.3.14. Oauth2 常见问题
84. Spring boot with Spring security(2.x)
84.1. Spring security 静态配置例子
84.1.1. Maven
84.1.2. Reource
84.1.3. Application
84.1.4. WebSecurityConfigurer
84.1.5. RestController
84.1.6. 测试
84.2. Spring + Security + MongoDB
84.2.1. Account
84.2.2. AccountRepository
84.2.3. WebSecurityConfiguration
84.3. Spring Boot with Web Security(2.x)
84.3.1. EnableWebSecurity
84.3.2. Web静态资源
84.3.3. 正则匹配
84.3.4. 登陆页面,失败页面,登陆中页面
84.3.5. CORS
84.3.6. X-Frame-Options 安全
84.4. 访问控制列表(Access Control List,ACL)
84.4.1. antMatchers
84.4.2. HTTP Auth
84.4.3. Rest
84.4.4. hasRole
84.4.5. hasAnyRole()
84.4.6. withUser
VIII. Spring Cloud
85. Spring Cloud
85.1. Spring Cloud 相关的 application.properties 配置
85.1.1. 启用或禁用 bootstrap
85.1.2. bootstrap.properties 配置文件
86. Spring Cloud Config
86.1. Maven 项目 pom.xml 文件
86.2. Server
86.2.1. Maven config 模块
86.2.2. Application
86.2.3. application.properties
86.2.4. Git 仓库
86.2.5. 测试服务器
86.3. Client
86.3.1. Maven pom.xml
86.3.2. Application
86.3.3. bootstrap.properties
86.3.4. 测试 client
86.4. Config 高级配置
86.4.1. 仓库配置
86.4.2. Config server 用户认证
86.4.3. 加密敏感数据
86.4.4. Spring Cloud Config JDBC Backend
86.5. Old
86.5.1. Server (Camden.SR5)
86.5.2. Client (Camden.SR5)
87. Spring Cloud Consol
87.1. Spring Cloud Consul 配置
87.2. Maven 父项目
87.3. Consul 服务生产者
87.3.1. Maven
87.3.2. application.properties
87.3.3. SpringApplication
87.3.4. TestController
87.4. Consul 服务消费者
87.4.1. Maven
87.4.2. application.properties
87.4.3. SpringApplication
87.4.4. TestController
87.5. Openfeign
87.5.1. Maven
87.5.2. application.properties
87.5.3. SpringApplication
87.5.4. Feign 接口
87.5.5. TestController
88. Spring Cloud Netflix
88.1. Eureka Server
88.1.1. Maven
88.1.2. Application
88.1.3. application.properties
88.1.4. 检查注册服务器
88.2. Eureka Client
88.2.1. Maven
88.2.2. Application
88.2.3. RestController
88.2.4. application.properties
88.2.5. 测试
88.3. Feign client
88.3.1. Maven
88.3.2. Application
88.3.3. interface
88.3.4. application.properties
88.3.5. 测试
88.3.6. fallback
88.4. 为 Eureka Server 增加用户认证
88.4.1. Maven
88.4.2. application.properties
88.4.3. Eureka Client
88.4.4. Feign Client
88.5. Eureka 配置项
88.5.1. /eureka/apps
88.5.2. Eureka instance 配置项
88.5.3. Eureka client 配置项
88.5.4. Eureka Server配置项
88.6. ribbon
88.6.1.
88.6.2. LoadBalancerClient 实例
88.6.3. Ribbon 相关配置
88.7. 获取 EurekaClient 信息
88.8. Zuul
88.8.1. Maven
88.8.2. EnableZuulProxy
88.8.3. application.yml
88.8.4. 负载均衡配置
89. Openfeign
89.1. Openfeign 扫描包配置
89.2. 用户认证
89.3. 应用实例
89.4. 配置连接方式
89.4.1. httpclient
89.4.2. okhttp
89.5. 配置手册
90. Spring Cloud Gateway
90.1. Gateway 例子
90.1.1. Maven
90.1.2. SpringApplication
90.1.3. application.yml
90.1.4. RouteLocator 方式
90.2. 路由配置
90.2.1. 转发操作
90.2.2. URL 参数
91. Spring Cloud Sleuth
91.1. logback 安装
92. Spring Cloud with Kubernetes
92.1. Config
92.1.1. Maven 依赖
92.1.2. Spring Cloud 配置文件
92.1.3. 程序文件
92.1.4. Kubernetes 编排脚本
92.1.5. 测试
92.2. 注册发现
92.2.1. Maven 父项目
92.2.2. provider
92.2.3. consumer
92.2.4. 测试
92.2.5.
93. Spring Cloud Alibaba
93.1. 安装 Nacos
93.1.1. Docker 安装 Nacos
93.1.2. Kubernetes 安装 Nacos
93.1.3. IP限制,白名单
93.1.4. 防火墙配置
93.2. Kubernetes 部署微服务
93.2.1. pom.xml 中加入 docker 插件
93.2.2. 容器启动脚本
93.2.3. 构建 docker 镜像
93.2.4. 编排 kubernetes 容器
93.2.5. 启动指定 nacos
93.3. Nacos 配置中心/注册中心代码实例
93.3.1. Maven
93.3.2. SpringBootApplication
93.3.3. ConfigController
93.3.4. 配置文件
93.4. FAQ
93.4.1. 禁用 Nacos
93.4.2. 禁止注册
93.4.3. Failed to bind properties under 'server.tomcat.basedir' to java.io.File:
93.4.4. 不读取 bootstrap.yaml 文件
93.4.5. WARN [com.alibaba.nacos.client.naming:177] [,] - out of date data received, old-t: 1665711914993, new-t: 1665711902390
93.4.6. User limit of inotify instances reached or too many open files
93.4.7. 开启权限
93.4.8. ERROR Whitelabel
93.4.9.
94. FAQ
94.1. Cannot execute request on any known server
94.2. @EnableDiscoveryClient与@EnableEurekaClient 区别
94.3. Feign请求超时
94.4. 已停止的微服务节点注销慢或不注销
94.5. Feign 启动出错 PathVariable annotation was empty on param 0.
94.6. Feign 提示 Consider defining a bean of type 'common.feign.Cms' in your configuration.
94.7. Load balancer does not have available server for client
94.8. Eureka Client (Dalston.SR1)
94.8.1. Maven
94.8.2. Application
94.8.3. RestController
94.8.4. application.properties
94.8.5. 测试
94.9. Config Server(1.3.1.RELEASE)
94.9.1. Server
94.9.2. Client
94.10. feign.RetryableException: Read timed out executing
95. Spring Integration
95.1. Spring Redis Lock
95.1.1. Maven 依赖
95.1.2. 配置锁
95.1.3. 使用方法
95.2. MQTT Support
95.2.1. 入站消息通道适配器
95.2.2. 出站通道适配器
95.2.3. @MessagingGateway 定义消息网管接口
95.2.4. 手动 ACK 应答
95.2.5. Spring boot with Mqtt v5
96. MyBatis
96.1. Mybatis 入门
96.2. 接口注解
97. Apache Struts
97.1. struts.xml
97.1.1. include
97.2. Struts Tags
97.2.1. property
97.2.2. set
97.2.3. url
97.2.4. s:include
97.2.5. s:action
97.2.6. HTML Form
97.2.7. iterator
97.2.8. if elseif else
97.3. Action
97.3.1. redirect
97.3.2. redirectAction
97.3.3. JSON
97.3.4. 传递 Timestamp 变量
97.4. Ajax + JSON
97.4.1. GET/POST JSON
97.5. Json 内容展示
97.5.1. 禁止方法
97.5.2. 格式化日期
97.5.3. 重命名变量名
97.5.4. org.apache.struts2.json
97.6. Interceptor
97.6.1. Session
97.7. Action 中使用线程
97.8. 日志
97.9. FAQ
97.9.1. Struts 怎样判断用户来自电脑还是移动设备
98. Apache Tiles
98.1. 配置 Tiles
98.1.1. Maven
98.1.2. web.xml
98.2. Template 配置模板
98.3. Struts tiles
99. Play
100. Servlet
100.1. Example
100.2. Session
100.3. HttpServletRequest
100.4. Filter
100.4.1. web.xml
100.4.2. Filter 类
100.5. Listener
100.5.1. web.xml
100.5.2. NewsListener 类
100.5.3. NewsTask 类
100.5.4. JSP 中心显示
100.6. JSP
100.6.1. 注释
100.6.2. pageContext
100.6.3. request
100.6.4.
100.6.5. cookie
100.6.6. session
100.6.7. page
100.6.8. trimDirectiveWhitespaces
100.6.9. include
100.6.10. jsp
100.6.11. error-page
100.6.12. JSP 编程
100.6.13. FAQ
100.7. JSTL(JavaServer Pages Standard Tag Library)
100.7.1. c:set
100.7.2. c:out
100.7.3. c:url
100.7.4. c:redirect
100.7.5. c:import
100.7.6. c:if
100.7.7. c:choose
100.7.8. c:forEach
100.7.9. empty 判断是否为空
100.7.10. JSTL fmt Tag setBundle Example
100.8. WebSocket
100.8.1. Server
100.8.2. Client
101. Log
101.1. Logback
101.1.1. Maven 包
101.1.2. Example
101.2. slf4j
101.3. log4j
101.3.1. 安装 Log4j
101.3.2. log4j 环境变量
101.3.3. Log4j Example
101.3.4. log4j.properties
102. AMQP(Advanced Message Queuing Protocol)
102.1. Send and Recv
102.2. direct
103. NoSQL
103.1. MongoDB
103.1.1. pom.xml
103.1.2. 插入操作
103.1.3. 读取操作
104. Elasticsearch API
104.1. Client
104.2. insert
104.3. Get
104.4. delete
104.5. Search
104.6. Query 查询
104.6.1. match all 匹配所有数据
104.6.2. match 匹配查询
104.6.3. match phrase 短语精准匹配
104.7. Filter 过滤
104.7.1. term
104.7.2. range
104.8. Sorting
104.9. 返回 Source 字段
104.10. Count
104.11. Example 范例
104.11.1. Spring boot 案例
104.12. FAQ
104.12.1. 显示查询 JSON 字符串
105. Jersey - RESTful Web Services in Java.
105.1. Client 2.x
105.1.1. Maven 版本
105.1.2. GET 操作
105.1.3. GET + Auth 用户认证
105.2. Client 1.x
105.2.1. Jersey + Auth + HTTP2 + SSL
106. Apache HttpComponents
106.1. org.apache.commons.lang3
106.1.1. HTML 标签处理
106.1.2. StringUtils.join 使用特定字符链接字符串
106.1.3. RandomStringUtils
106.2. commons-text
106.2.1. 禁止转译 json
106.3. Apache HttpClient
106.3.1. Maven
106.3.2. HTTP POST 操作
106.3.3. HTTPS
106.3.4. HTTP/2
106.3.5. Java11
106.3.6. Host name 'api.netkiller.cn' does not match the certificate subject provided
106.3.7. HttpStatus
106.3.8.
107. Cache
107.1. java memcached client
107.2. Jedis
107.2.1. 认证
107.2.2. jedis.keys
107.3. Ehcache
108. Kafka
108.1. 安装 Kafka 环境
108.2. Maven
108.3. 启动 kafka
108.4. 入门例子
108.4.1. 订阅例子
108.4.2. 发布例子
108.5. 线程例子
109. Software Development Kit
109.1. JAVE(Java Audio Video Encoder)
109.2. Google
109.2.1. com.google.gson
109.2.2. Guava
109.3. Mahout
109.3.1. 推荐系统
109.4. Hessian
109.5. quartz-scheduler
109.6. Redisson
IX. Android
110. Android Studio
110.1. 卸载 Android Studio
110.2. 代码格式化
110.3. 设置兼容最低SDK版本
110.4. SDK Tools
110.4.1. 接受 License
110.4.2. 查看 SDK 列表
110.4.3. 按照 Android SDK
110.5. 命令行操作
110.6. adb 命令
110.6.1. 获得 root 权限
110.6.2. 设备管理
110.6.3. Shell
110.6.4. 设备 ID
110.6.5. 查看安卓版本
110.6.6. Logcat
110.6.7. 上传文件
110.6.8. 下载文件
110.6.9. 安卓 .apk bk
110.6.10. 屏幕尺寸
110.6.11. dump 系统信息
110.6.12. 解锁
110.6.13. 蓝牙管理
111. AndroidManifest.xml
111.1. SDK 版本配置
111.2. 开启网络
111.3. 文件存储权限
111.4. 相机权限
111.5. GPS 定位权限
111.6. 全屏-无标题
111.7. 设置为默认开机启动
111.8. 开机启动
111.9. 默认横屏
111.10. 禁止屏幕旋转变化
112. 设备
112.1. 环境变量
112.1.1. 扩展存储
112.1.2. 下载缓存目录
112.1.3. 数据目录
112.2. 配置文件
112.2.1. *.properties 文件
112.2.2. 再 AndroidManifest.xml 使用 meta-data element 定义
112.2.3. 再 build.gradle 文件中配置 productFlavors
112.2.4. 从 assets 目录读取配置文件
112.3. 设备信息
112.4. Physical density
112.5. 声卡
112.5.1. 播放
112.5.2. 录音
112.5.3. 查看声卡信息
112.5.4. /proc/asound 设备信息
112.5.5. 查看声卡当前占用设备
112.5.6. tinymix 设置声卡参数
112.5.7. 麦克风阵列调试
113. Activity
113.1. 定义 UI
113.2. 隐藏虚拟键
113.3. 显式四种跳转方式
113.3.1. startActivity()
113.4. 定时关闭
113.5. 恢复触发
113.6. 返回触发
113.7. 保持屏幕常开
113.8. 标题栏添加返回按钮
113.9. Activity 间数据传递
113.9.1. Intent 方式
113.9.2. Bundle 方式
113.9.3. Flag 属性
113.9.4. 返回值
113.10. intentActivityResultLauncher 跳转
113.11. startActivityForResult 替代方案
113.11.1. 返回值
113.12. Activity 关闭
113.12.1. 退出 App
113.13. App 间跳转
113.14. Res 资源
113.14.1. 通过名称查找 layout ID
113.14.2. 查找 drawable 资源 ID
113.14.3. 获取 color 颜色 ID
113.14.4. 获取 array.xml 文件下某个字段的 ID
113.14.5. 获取 style.xml 文件下的某个样式的 id
114. Fragment
114.1. 启动 Fragment
114.2. 关闭 Fragment
114.3. 在 Fragment 中使用 findViewById
114.4. 在 Fragment 中使用 Intent 跳转
114.5. Fragment 中调用 getPackageManager()
114.6. 在 Fragment 中使用 runOnUiThread
114.7. Fragment 中调用 findViewById
114.8. 替换 FrameLayout
114.9. Fragment 接收 BroadcastReceiver 广播
115. Resources
115.1. strings.xml
115.1.1.
115.1.2.
115.1.3. 获取 Resource
116. Palette 视觉设计
116.1. 父容器定位
116.2. 样式布局
116.2.1. 对齐布局
116.2.2. LinearLayout
116.2.3. FrameLayout
116.2.4. 动画
116.2.5. 声音波形图
116.3. Widgets
116.3.1. ImageView
116.3.2. TextClock
116.3.3. 进度条
116.4. Containers
116.4.1. CardView
116.5. Legacy
116.5.1. GardView
116.5.2. GridView
116.6. 渐变背景色
116.7. 屏幕
116.7.1. 尺寸
116.7.2. 屏幕触摸事件 onTouch(View view, MotionEvent motionEvent)
116.7.3. 手势事件
118. Schedule 计划任务
118.1. 延迟执行
118.2. Time 和 TimerTask 定时刷新
118.3. 使用 Runnable 和 Handler 实现定时执行
118.4. 循环执行
118.5. TimerTask 实现循环播放
118.6. TimerTask 更新 UI
119. Internationalization i18n with Android (国际化)
119.1. 创建国际化文件
119.2. strings.xml 文件
119.3. 翻译语言
119.4. 引用国际化文件
119.5. 切换语言
120. 存储
120.1. 存储目录
120.2. SharedPreferences
120.2.1. 操作模式
120.2.2. 保存数据
120.2.3. 读取数据
120.2.4. 通过 key 查询数据是否存在
120.2.5. 删除数据
120.2.6. 清空数据
120.2.7. 对象存储
120.2.8. SharedPreferences 读取物理存储文件
120.3. SD Card
120.3.1. SD Card 状态
120.3.2. Android 11 申请 sdcard 权限
121. 网络
121.1. Wifi 配置
121.2. OkHttp - An HTTP & HTTP/2 client for Android and Java applications
121.2.1. Gradle
121.2.2. AndroidManifest.xml 开启网络访问权限
121.2.3. okhttp 默认是 HTTPS 开启 HTTP
121.2.4. GET
121.2.5. POST
121.2.6. HTTP PUT 请求
121.2.7. http header 相关设置
121.2.8. HTTP Base Auth
121.2.9. HttpUrl.Builder 组装 URL 地址参数
121.2.10. Android Activity Example
121.2.11. Android Oauth2 + Jwt example
121.2.12. HTTP/2
121.2.13. 异步更新 UI
121.2.14. WebSocket Client
122. 相机与相册
122.1. manifest 文件
122.2. layout
122.3. Activity
122.4. LED flash 做手电筒
123. 麦克风与录音
123.1. 开启麦克风和SD卡权限
123.2. layout
123.3. Activity
124. 多媒体开发
124.1. MediaPlayer
124.1.1. 播放Raw下的元数据
124.1.2. 播放assets文件夹中的音乐
124.1.3. 播放互联网音乐
124.1.4. 使用单例模式
124.1.5. 设置速度,快进播放
124.2. VideoView 开发
124.2.1. 播放网络视频
124.2.2. MediaController 添加翻页事件
124.2.3. 静音播放视频
124.2.4. 更新进度条
124.2.5. 完整的例子
124.2.6. 循环播放
124.2.7. 静音播放
124.3. SoundPool
124.4. 音量控制
124.5. SurfaceView
124.6. Vitamio
125. 定位
125.1. GPS + 网络 定位
125.1.1. manifest 权限配置
125.1.2. layout
125.1.3. Activity
125.2. 只从 GPS 获取定位
126. 电话
126.1. SIM 卡状态
126.2. 通信录与拨打电话
126.3. 发送短信
127. 消息广播
127.1. 动态注册
127.2. 静态注册
127.2.1. 电源管理
127.2.2. 接收不到消息
127.3. 自定义用户消息广播
127.4. 本地广播
127.5. 动态监听广播
127.6. 广播重复接收
127.7. 指定静态广播接收者
127.8. 异步执行广播
128. Service 服务
128.1. Service的基本用法
128.1.1. manifest 文件
128.1.2. 创建 Service
128.1.3. Layout 代码
128.1.4. Activity 代码
128.2. Service 中启动线程
128.3. Service 和 Activity 通信
128.3.1. Layout
128.3.2. Service
128.3.3. Activity
128.4. Service 和 Toast
128.5. Service 中启动 Activity
128.6. Service 中更新 UI
129. Notification 通知中心
129.1. 文本通知
129.2. 添加点击操作
130. NFC (Near field communication)
130.1. AndroidManifest.xml 文件配置
130.2. Loyout 文件
130.3. Activity 文件
131. 图形开发
131.1. Paint
131.2. AnimationDrawable
132. 下载管理
132.1. 从 URL 下来文件
132.2. 安装 APK
132.3. 下载后接收广播通知
133. Android 多线程
133.1. GPIO
134. EventBus
134.1. 添加 EventBus 依赖到项目Gradle文件
134.2. 快速开始一个演示例子
134.2.1. 创建 MessageEvent 类
134.2.2. Layout
134.2.3. Activity
134.3. Sticky Events
134.3.1. MainActivity
134.3.2. StickyActivity
134.3.3. MessageEvent
134.3.4. 删除粘性事件
134.4. 线程模型
134.5. 配置 EventBus
134.6. 事件优先级
134.7. 捕获异常事件
135. Android MQTT
135.1. build.gradle 添加依赖包
135.2. AndroidManifest.xml
135.3. Android Mqtt v5 例子
136. 安卓开发版
136.1. rk3568
136.1.1. 声卡
137. 杂项
137.1. Sleep
137.2. Caused by: java.net.UnknownServiceException: CLEARTEXT communication to 47.100.253.187 not permitted by network security policy
137.3. 设计模式
137.3.1. 单例模式
137.4. Android OS 包
137.4.1. 进程ID
137.4.2. handler
137.5. fastjson android
137.5.1. 对象转字符串
137.5.2. JsonObject 转对象
137.5.3. 字符串 与 json 互转
137.5.4. json 转 数组
137.5.5. JSON数组转List
137.5.6. Map 与 Json 互转
137.6. Butter Knife
137.7. Android Things
137.7.1. GPIO
138. FAQ
138.1. java.net.UnknownServiceException: CLEARTEXT communication to 192.168.0.185 not permitted by network security policy
138.2. Caused by: android.os.NetworkOnMainThreadException
138.3. java.lang.IllegalStateException: Player is accessed on the wrong thread.
138.4. Manifest merger failed with multiple errors, see logs
138.5. 从 Android API 30 废弃 setSystemUiVisibility(uiOptions)
139. 讯飞云
139.1. AIUI
139.1.1. AIUIPlayer
139.1.2. 酷我音乐
139.1.3. 控制技能
139.1.4. 唤醒词
139.1.5. 汉字转拼音
139.2. 讯飞 TTS
139.2.1. 设置日志输出级别
139.2.2. 流式语音合成
139.3. 语音唤醒
139.3.1. 范例
1. 附录
1.1. 一致性算法

范例清单

1.1. /etc/profile.d/java.sh
23.1. Maven properties
23.2. 将本地 lib/*.jar 包添加到项目中
23.3. 将本地 src/resources 打包到项目
23.4. Maven parent
23.5. watir-webdriver example
37.1. Example Spring boot with Oracle
8. RedisTemplate
45.1. Spring boot with Apache kafka.
45.2. Spring boot with Apache kafka.
45.3. Test Spring Kafka
60.1. Spring boot with Email (pom.xml)
71.1. Spring boot with Velocity template (pom.xml)
73.1. MyBatis
77.1. Spring Data Redis Example
78.1. Spring Data MongoDB - springframework-servlet.xml
94.1. Share feign interface.
107.1. memcached.java
118.1.