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

Netkiller Java 手札(2026版)

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

Mr. Neo Chan, 陈景峰(BG7NYT)



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


文档始创于 2015-11-10

电子书最近一次更新于 2026-07-14 16:58:55

版权声明

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

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. Rocky Linux 9 / Almalinux 9 + Maven + OpenJDK25
1.2. Java 21
1.3. Almalinux / RockyLinux
1.4. CentOS 8 Java 14
1.5. Java 版本切换
1.6. 安装 Java 6
1.6.1. HeapDumpOnOutOfMemoryError
1.7. java-1.8.0-openjdk
1.8. docker 环境
1.9. java - Launches a Java application.
1.9.1. java 9~11
1.9.2. -verbose:class 显示载入jar文件
1.9.3. java.io.tmpdir
1.9.4. 显示版本号
1.9.5. 列出java模块
1.10. Java 相关命令
1.10.1. jps
1.10.2. jar
1.10.3. jdeps - Java class dependency analyzer.
1.10.4. JShell
1.10.5. jlink
2. exec 运行shell
2.1. System
2.1.1. System
2.1.2. System.in 标准输入(Stdin)
2.1.3. ANSI Color
2.2. Java 嵌入 Python 代码
3. 数据类型
3.1. var 本地变量类型推断
3.2. Integer 整形
3.2.1. 字符串转整数
3.2.2. 进制转换
3.2.3. 前面补零
3.2.4. NumberFormat 数字格式化
3.2.5. 从字符串中提取数字
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. String.format 字符串格式化
3.3.12. DecimalFormat 文本格式化
3.3.13. 通过 stream() 匹配一组字符串
3.3.14. 字符串输出转译字符串
3.4. 类型转换
3.4.1. Long to String
3.5. Date 日期时间
3.5.1. String to Date
3.5.2. DateTimeFormatter 格式化日期和时间
3.5.3. SimpleDateFormat 格式化日期和时间
3.5.4. Timestamp
3.5.5. TimeZone
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.5.12. Duration
3.5.13. 计算流逝时间
3.6. Array 数组
3.6.1. 字符串转数组
3.6.2. for each
3.6.3. Array to String
3.6.4. 数据转字符串
3.6.5. 字符串转数组
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[] 填充数据 0
3.12.3. byte[] to String
3.12.4. BigInteger2byte
3.12.5. int to byte array
3.12.6. byte array to int
3.12.7. byte2char
3.12.8. longToByte64
3.12.9. byte64ToLong
3.12.10. short2byte
3.12.11. byte8ToDouble
3.12.12. byte4ToFloat
3.12.13. 无符号 byte
3.12.14. byte to hex
3.12.15. byte[] to hex
3.12.16. 连接两个 byte[]
3.12.17. 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.3.1. 在 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.3.2. 判断线程是否存活
7.3.3. 获取线程状态
7.3.4. 安装终止一个线程
7.4. 实现 Runnable 接口
7.5. 线程同步
7.6. ThreadLocal
7.7. ScopedValue
7.8. ThreadLocalMap
7.9. InheritableThreadLocal
7.10. 守护线程
7.11. 线程等待与线程通知
7.11.1. 通知所有线程
7.11.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.
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. Vector
8.6. Set
8.6.1. Set 初始化
8.6.2. Set 转为 List
8.6.3. Set.of()
8.6.4. Set to Array
8.7. Map
8.7.1. 初始化
8.7.2. HashMap
8.7.3. LinkedHashMap
8.7.4. NavigableMap
8.7.5. 遍历数据
8.7.6. 迭代器
8.7.7. Map forEach
8.7.8. 随机取值
8.7.9. 有序 Key 值,HashMap 与 LinkedHashMap 对比
8.7.10. 调换 map 的 key 与 value 位置
8.8. Iterator
8.8.1. List 迭代
8.8.2. 处理剩余结果
8.8.3. Map 迭代
8.8.4. Iterator 与 List 的区别
8.8.5. remove() 删除操作
8.8.6. Iterable 转 List
8.8.7. ListIterator
8.8.8. Iterable
8.9. Queue
8.9.1. 阻塞队列
8.9.2. LinkedBlockingQueue
8.9.3. Deque 双端队列
8.9.4. 数据转换
8.9.5. PriorityBlockingQueue
8.10. Stack
8.11. Optional
8.11.1. of() 为非null的值创建一个Optional。
8.11.2. ofNullable() 为指定的值创建一个Optional,如果指定的值为null,则返回一个空的Optional。
8.11.3. isPresent 如果值存在返回true,否则返回false。ifEmpty() null 返回 true 否则返回 false
8.11.4. ifPresent() 如果Optional实例有值执行 lambda 表达式
8.11.5. get() 返回值
8.11.6. orElse 如果有值则将其返回,否则返回指定的其它值。
8.11.7. orElseGet与orElse方法类似,区别在于得到的默认值从 Supplier 返回。
8.11.8. orElseThrow 如果有值则将其返回,否则抛出supplier接口创建的异常
8.11.9. map() 方法用来对Optional实例的值执行一系列操作
8.11.10. flatMap()
8.11.11. filter() 通过传入限定条件过滤Optional值
8.11.12. stream()
8.11.13. or()
8.11.14. example
9. 正则表达式
9.1. 正则查找
9.2. 正则替换
9.3. 字符串分割
10. Java 并发编程
10.1. TimeUnit
10.2. ThreadLocalRandom
10.3. 原子变量
10.3.1. AtomicInteger / AtomicLong
10.3.2. AtomicBoolean
10.3.3. AtomicReference
10.3.4. 值设置与获取操作
10.4. ReentrantLock 锁
10.5. 线程安全的 HashMap(ConcurrentHashMap)
10.5.1. 设置键与值
10.6. CopyOnWriteArraySet
10.7. 队列 / 阻塞队列
10.7.1. ConcurrentLinkedQueue 非阻塞队列
10.7.2. ArrayBlockingQueue
10.7.3. LinkedBlockingQueue
10.7.4. PriorityBlockingQueue
10.7.5. ConcurrentLinkedQueue
10.7.6. LinkedTransferQueue
10.7.7. LinkedBlockingQueue LinkedTransferQueue ConcurrentLinkedQueue
10.8. Future
10.8.1. Future + Stream 管理一组线程
10.8.2. Future + ExecutorService
10.9. FutureTask
10.10. StructuredTaskScope
10.10.1. StructuredTaskScope Example
10.11. CompletableFuture
10.11.1. 创建 CompletableFuture 实例,并且其他线程中使用
10.11.2. runAsync 创建没有返回值的异步任务
10.11.3. thenRun / thenRunAsync
10.11.4. supplyAsync 创建带有返回值的异步任务。
10.11.5. thenAccept / thenAcceptAsync
10.11.6. 获取结果
10.11.7. thenApply / thenApplyAsync
10.11.8. runAsync / thenAccept / thenApply 区别
10.11.9. whenComplete 任务完成时执行,并且返回结果和异常
10.11.10. 超时处理
10.11.11. 按顺序执行
10.11.12. thenCombine、thenAcceptBoth 和runAfterBoth
10.11.13. applyToEither、acceptEither和runAfterEither
10.11.14. allOf / anyOf
10.11.15. 并行执行 CompletableFuture
10.11.16. 通知完成任务
10.11.17. 异常处理
10.11.18. CompletableFuture 实现 Pipeline 流水线
10.12. java 线程池
10.12.1. newCachedThreadPool
10.12.2. 固定线程池(newFixedThreadPool)
10.12.3. Executors.newScheduledThreadPool
10.12.4. SingleThreadExecutor
10.12.5. ExecutorService 正确关闭方法
10.12.6. ForkJoinPool / ForkJoinTask
10.13. Flow
10.13.1. 自定义 Publisher / Subscriber
10.13.2. SubmissionPublisher
10.13.3. Flow.Processor
10.13.4. 订单
10.14. Java 虚拟线程(协程)
10.14.1. 与 Future 配合使用
10.14.2. 虚拟线程并发控制
11. Stream
11.1. Stream.of
11.2. Stream.ofNullable
11.3. filter
11.4. map
11.5. peek 打印调试信息
11.6. limit/skip
11.7. sorted
11.8. distinct
11.9. forEach
11.10. count
11.11. 流转列表
11.12. collect
11.12.1. Collectors.toList() 列表转字符串
11.12.2. Collectors.joining() 连接字符串
11.12.3. 转 Set Collectors.toSet()
11.12.4. Collectors.teeing()
11.13. takeWhile 和 dropWhile
11.14. 合并 Stream
11.15. mapToObj
11.16. Collectors
11.16.1.
11.16.2. 过滤空值
11.17. 混合使用的例子
11.17.1. List to Stream
11.18. 流复用 streamSupplier
11.19. Parallel Streams(并行流)
11.20. IntStream
11.21. LongStream
11.22. DoubleStream
11.23. 例子
11.23.1. Markdown 转 CSV
12. 函数式编程
12.1. Supplier 供应型的接口
12.1.1. Supplier 作为方法参数使用
12.1.2. IntSupplier
12.1.3. LongSupplier
12.1.4. DoubleSupplier
12.1.5. BooleanSupplier
12.2. Consumer 消费型的接口
12.2.1. IntConsumer
12.2.2. 无返回值 Void
12.3. BiConsumer
12.4. BiFunction
12.5. Predicate 判断型的接口
12.6. Supplier / Consumer / Predicate 应用场景
12.7. Map + Function
12.8. Predicate + Stream
12.9. Enum + Function
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.1.3. 文件删除
15.1.4. 获取路径中目录和文件名
15.1.5. 临时文件
15.2. FileWriter 文本写入文件
15.3. Files
15.3.1. 删除文件
15.3.2. 创建目录和文件
15.4. BufferedWriter
15.5. PrintWriter
15.6. FileOutputStream
15.6.1. FileOutputStream + try 用法
15.6.2. OutputStreamWriter
15.7. FileInputStream
15.7.1. InputStreamReader
15.7.2. inputStream.transferTo()
15.8. Scanner
15.9. Files
15.9.1. Files.lines
15.9.2. Files.readAllLines
15.9.3. Files.readAllBytes
15.9.4. Files.newBufferedReader
15.9.5. Files.delete
15.10. 二进制文件
15.10.1. 理解二进制文件
15.10.2. byte 类型
15.10.3. boolean 布尔型
15.10.4. Long 型
15.10.5. char 类型
15.10.6. UTF 字符串
15.10.7. Short 类型
15.10.8. float 单精度浮点类型
15.10.9. double 数据类型
15.10.10. 二进制文件操作演示
15.11. 路径操作汇总
15.11.1. 获得 Resource 下文件路径
15.11.2. URI/相对/拒绝/路径/文件
15.11.3. URL 操作汇总
15.11.4. nio 路径库
15.12. 遍历目录和文件
15.12.1. listFiles()
15.12.2. Files.newDirectoryStream
15.12.3. Files.list
15.12.4. Files.walk 递归遍历目录
15.12.5. SimpleFileVisitor
16. Network
16.1. URL
16.1.1. 获取路径/文件名
16.1.2. 打开 URL
16.2. URLConnection
16.3. HttpURLConnection
16.3.1. GET 请求
16.3.2. POST 请求
16.3.3. POST JSON
16.4. 获取IP地址何机器名
16.5. HttpClient HTTP/3 (QUIC协议)
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 值
19.3. Md5sum
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. Rocky Linux 9 + Maven 3.3.9 + OpenJDK25
23.1.2. CentOS 8 安装 Maven
23.1.3. Ubuntu
23.1.4. 一键安装
23.1.5. apache-maven-3.8.2
23.1.6. Nexus Repository OSS
23.1.7. MacOS
23.1.8. 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. 从 archetype 模版创建项目
23.2.8. clean
23.2.9. compile
23.2.10. 编译测试代码
23.2.11. test
23.2.12. package
23.2.13. install
23.2.14. war
23.2.15. exec
23.2.16. dependency
23.2.17. jar
23.2.18. 构建装配Maven Assembly
23.2.19. 加密密码
23.2.20. 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
24.6. Github Packages
24.6.1. Publishing a package
24.6.2. Using a published package
25. JitPack - Easy to use package repository for Git
26. Spring Boot
26.1. Spring Boot Quick start
26.1.1. Springboot with Maven
26.2. Spring 开发环境
26.3. SpringApplication
26.3.1. 运行 Spring boot 项目
26.3.2. @SpringBootApplication
26.4. 如何优雅停止 Springboot 运行
26.5. Springboot with Properties 配置文件
26.6. Spring boot with Logging
26.7. Springboot with Undertow / Jetty / http2
26.7.1. Spring boot with Undertow
26.7.2. Spring boot with HTTP2 SSL
26.8. Spring boot with MongoDB
26.9. Spring boot with MySQL
26.10. Spring boot with Oracle
26.11. Spring boot with PostgreSQL
26.12. Spring boot with Elasticsearch
26.13. Spring boot with Elasticsearch TransportClient
26.14. Spring boot with Apache Hive
26.15. Spring boot with Phoenix
26.16. Spring boot with Datasource
26.16.1. Master / Slave 主从数据库数据源配置
26.17. 连接池配置
26.17.1. druid
26.18. Spring boot with Redis
26.18.1. Spring boot with Redis
26.18.2. Redis Pub/Sub
26.18.3. Sprint boot with Redisson
26.19. Spring boot with Queue
26.19.1. Spring boot with RabbitMQ(AMQP)
26.19.2. Spring boot with Apache Kafka
26.20. Spring boot with Scheduling
26.20.1. 启用计划任务
26.20.2. @Scheduled 详解
26.20.3. cron 表达式
26.21. Spring boot with Swagger
26.21.1. Spring boot with Springdoc
26.21.2. Spring boot with knife4j
26.21.3. springfox
26.22. Spring boot with lombok
26.23. Spring boot with Container
26.23.1. Spring boot with Docker
26.23.2. Spring boot with Docker stack
26.23.3. Spring boot with Kubernetes
26.24. Spring boot with command line
26.25. Spring Boot Actuator
26.25.1. 与 Spring Boot Actuator 有关的配置
26.25.2. 健康状态
26.25.3. info 配置信息
26.26. SpringBootTest
26.27. Spring boot with Aop
26.28. Spring boot with starter
26.28.1. 实现 starter
26.28.2. 引用 starter
26.29. Spring boot with Monitor
26.29.1. SpringBoot Admin
26.29.2. Spring boot with Grafana
26.29.3. Spring Boot with Prometheus
26.30. Spring boot with Git version
26.31. Spring boot with Session share
26.31.1. Redis
26.32. Spring boot with Caching
26.33. Spring boot with Email
26.33.1. spring-boot-starter-mail
26.33.2. 用法详解
26.34. Spring boot with Hessian
26.35. Spring boot with Async
26.35.1. 带有返回值的异步任务
26.35.2. 默认简单线程池 SimpleAsyncTaskExecutor
26.35.3. ThreadPoolTaskExecutor 自定义线程池
26.35.4. 自定义线程池 ThreadPoolExecutor
26.36. Springboot with Ethereum (web3j)
26.37. Java Record 新特性
26.38. Spring boot with Retryable
26.38.1. @EnableResilientMethods
26.38.2. spring-retry
26.39. Springboot 接入阿里云
26.40. Spring Boot 4 + OpenTelemetry
26.41. Springboot with Koog for Java
IV. Spring Framework
27. Spring 框架
27.1. @Bean
27.1.1. @Scope 定义类型
27.1.2. InitializingBean
27.2. URL 拼装/解析
27.3. ServletUriComponentsBuilder
27.4. URL 路径相关
27.5. 声明式 HTTP 客户端 HttpExchange
27.5.1. 支持的注解类型
27.5.2. RestClient 例子
27.5.3. HTTP 头设置
28. Spring WebMVC
28.1. @EnableWebMvc
28.1.1. @PostConstruct
28.2. @Controller
28.2.1. @RequestMapping
28.2.2. @GetMapping
28.2.3. @PostMapping
28.2.4. @RequestBody
28.2.5. RequestMapping with Request Parameters - @RequestParam
28.2.6. @RequestHeader - 获取 HTTP Header 信息
28.2.7. RequestMapping with Path Variables - @PathVariable
28.2.8. @MatrixVariable注解,RFC3986定义URI的路径(Path)中可包含name-value片段
28.2.9. @ModelAttribute
28.2.10. @ResponseBody
28.2.11. @ResponseStatus 设置 HTTP 状态
28.2.12. @CrossOrigin
28.2.13. @CookieValue - 获取 Cookie 值
28.2.14. @SessionAttributes
28.2.15. ModelAndView
28.2.16. HttpServletResponse
28.2.17. HttpServletRequest
28.3. @RestController
28.3.1. 接口设计中 URL 参数,FORM 参数,JSON 怎么选择
28.3.2. 返回迭代器
28.3.3. 上传文件
28.3.4. 返回实体
28.3.5. JSON
28.3.6. 处理原始 RAW JSON 数据
28.3.7. 返回 JSON 对象 NULL 专为 "" 字符串
28.3.8. XML
28.3.9. 兼容传统 json 接口
28.3.10. 上传文件
28.3.11. 下载文件
28.3.12. Mime/MediaType
28.3.13. Spring boot with csv
28.3.14. Json 处理
28.3.15. synchronized
28.3.16. Spring boot with Emitter
28.3.17. forward 转发
28.4. Springboot 4.0
28.4.1. Api 版本控制
28.5. View
28.5.1. 配置静态文件目录
28.5.2. 添加静态文件目录
28.5.3. Using Spring’s form tag library
28.5.4. Thymeleaf
28.5.5. FreeMarker
28.5.6. i18n 国际化
28.6. Spring boot with Webpage
28.6.1. Maven
28.6.2. application.properties
28.6.3. Application
28.6.4. IndexController
28.6.5. src/main/webapp/WEB-INF/jsp/index.jsp
28.6.6. 集成模板引擎
28.7. Spring boot with Velocity template
28.7.1. Maven
28.7.2. Resource
28.7.3. Application
28.7.4. RestController
28.7.5. Test
28.8. Spring boot with Thymeleaf
28.8.1. Maven
28.8.2. application.properties
28.8.3. Controller
28.8.4. HTML5 Template
28.9. 校验器(Validator)
28.9.1. 依赖
28.9.2. 常规用法
28.9.3. 常用注解
28.9.4. 在 Service 中使用 Validator 检查数据
28.9.5. 自定义注解
28.10. Interceptor/Filter 拦截器/过滤
28.10.1. Session 拦截
28.10.2. Token 拦截
28.10.3. Authorization Bearer
28.10.4. 过滤器
28.10.5. 拦截器获取PathVariable变量
28.10.6. WebMvcConfigurer 拦截
28.10.7. Session 登录拦截器
28.11. String boot with RestTemplate
28.11.1. RestTemplate Example
28.11.2. GET 操作
28.11.3. POST 操作
28.11.4. PUT 操作
28.11.5. Delete 操作
28.11.6. 上传文件
28.11.7. HTTP Auth
28.11.8. PKCS12
28.11.9. Timeout 超时设置
28.12. RestClient
28.12.1. 创建 RestClient
28.12.2. Get 操作
28.12.3. Post Json
28.12.4. HTTP Authorization Basic
28.12.5. onStatus
28.12.6. Timeout 超时设置
28.12.7. 下载二进制流
28.12.8. 上传文件
28.12.9. Springboot 4.0 Version 版本号
30. Service
30.1. Application
30.2. 定义接口
30.3. 实现接口
30.4. 调用 Service
30.5. context.getBean 调用 Service
30.6. AopContext
30.7. Service 单例/多例模式
30.7.1. Service 是单例模式
30.7.2. Service 多例实现
30.8. 构造方法
31. Tomcat Spring 运行环境
31.1. Maven
31.2. Spring MVC configuration
31.3. Tomcat
31.4. 集成 Mybatis
31.4.1. pom.xml
31.4.2. properties
31.4.3. dataSource
31.4.4. SqlSessionFactory
31.4.5. Mapper 扫描
31.4.6. Mapper 单一class映射
31.4.7. Service
31.4.8. 测试实例
32. WebFlux framework
32.1. Getting Started
32.1.1. Maven
32.1.2. Application
32.1.3. RestController
32.1.4. 测试
32.2. WebFlux 与 SprintMVC 有什么不同?
32.2.1. 实验程序
32.2.2. 实验结果
32.3. WebFlux Router
32.3.1. Component 原件
32.3.2. 路由配置
32.4. RestController
32.4.1. Post 数据
32.4.2. Thymeleaf
32.4.3. Mono
32.4.4. Flux 返回多条数据
32.4.5. SSE
32.4.6. 末尾连接字符串
32.4.7. Flux scan
32.4.8. ConnectableFlux
32.4.9. 上传文件并保存
32.5. Newline Delimited JSON (NDJSON)
32.6. WebClient
32.6.1. 配置 WebClient
32.6.2. @Controller/@RestController 实例
32.6.3. Get 请求实例
32.6.4. URI 参数
32.6.5. 查询参数
32.6.6. Post 操作演示
32.6.7. Post 表单数据
32.6.8. 上传文件
32.6.9. 设置 HTTP 头
32.6.10. 同步阻塞等待返回结果
32.6.11. websocket
32.6.12. 获取 HTTP 链接状态
32.6.13. Http Base Authentication - 401 Unauthorized
32.6.14. SSE(Server-Sent Events)
32.6.15. 超时时间
32.6.16. share() 共享订阅数据
32.6.17. 打印调试日志
32.6.18. 解决 WebClient 截断 URI的问题
32.6.19. 异常处理
32.7. Webflux 安全
32.7.1. Token 拦截器
32.7.2. JWT
32.7.3. spring-boot-starter-security
32.8. R2DBC
32.8.1. MySQL
32.8.2. R2dbcEntityTemplate
32.8.3. MySQL Point 数据类型
32.9. Webflux Redis
32.9.1. Maven Redis 依赖
32.9.2. Redis 配置
32.9.3. Config
32.9.4. Service
32.9.5. RestController
32.10. Webflux Mongdb
32.10.1. Maven 依赖
32.10.2. Repository
32.10.3. Service
32.10.4. 控制器
32.11. 常见问题
32.11.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.
32.11.2. @EnableWebFluxSecurity 与 @EnableReactiveMethodSecurity 不生效
32.11.3. webflux netty 不支持 Content-Type: application/x-www-form-urlencoded
V. Spring Data
33. EntityManager
34. Spring Data with JdbcTemplate
34.1. execute
34.2. queryForInt
34.3. queryForLong
34.4. queryForObject
34.4.1. 返回整形与字符型
34.4.2. 查询 Double 类型数据库
34.4.3. 返回日期
34.4.4. 返回结果集
34.4.5. 通过 "?" 向SQL传递参数
34.4.6. RowMapper 记录映射
34.5. queryForList
34.5.1. Iterator 用法
34.5.2. for 循环
34.5.3. forEach 用法
34.6. queryForMap
34.7. query
34.7.1. ResultSet
34.7.2. ResultSetExtractor
34.7.3. RowMapper
34.8. queryForRowSet
34.9. update
34.10. MapSqlParameterSource
34.11. 实例参考
34.11.1. 参数传递技巧
35. Spring Data with MySQL
35.1. 选择数据库表引擎
35.2. 声明实体
35.2.1. @Entity 声明实体
35.2.2. @Table 定义表名
35.2.3. @Id 定义主键
35.2.4. @Column 定义字段:
35.2.5. 非数据库字段
35.2.6. @Lob 注解属性将被持久化为 Blog 或 Clob 类型
35.2.7. @NotNull 不能为空声明
35.2.8. @Temporal 日期定义
35.2.9. 创建日期
35.2.10. @DateTimeFormat 处理日期时间格式
35.2.11. Enum 枚举数据类型
35.2.12. SET 数据结构
35.2.13. JSON 数据类型
35.2.14. 嵌入
35.2.15. @JsonIgnore
35.2.16. @EnableJpaAuditing 开启 JPA 审计功能
35.2.17. 注释 @Comment
35.2.18. @Pattern 数据匹配
35.2.19. 实体继承
35.2.20. 虚拟列
35.2.21. 语言区域
35.3. 映射集合属性
35.3.1. List 集合
35.3.2. 数组集合
35.3.3. Map 集合
35.3.4. Set 集合
35.3.5. 外键名称
35.3.6. 集合表子查询
35.4. 外键
35.4.1. @JoinColumn
35.4.2. @OneToOne
35.4.3. OneToMany 一对多
35.4.4. ManyToMany 多对多
35.4.5. 外键级联删除
35.4.6. 外键级联操作
35.4.7. @JoinTable
35.4.8. @OrderBy
35.4.9. @JsonIgnoreProperties
35.4.10. 允许外键为 NULL
35.4.11. 只要外键,不要数据结构
35.5. 索引
35.5.1. 普通索引
35.5.2. 组合索引
35.5.3. 唯一索引
35.6. Repository/CrudRepository/PagingAndSortingRepository/JpaRepository
35.6.1. JpaRepository
35.6.2. CrudRepository
35.6.3. PagingAndSortingRepository
35.6.4. findByXXX
35.6.5. count 操作
35.6.6. delete 删除操作
35.6.7. IsNull
35.6.8. In/NotIn
35.6.9. TRUE / FALSE
35.6.10. 比较数值大小
35.6.11. 判断日期和时间 Before / After
35.6.12. Between
35.6.13. Exists
35.6.14. OrderBy
35.6.15. GreaterThan
35.6.16. Sort 排序操作操作
35.6.17. Pageable 翻页操作
35.6.18. @DynamicInsert 与 @DynamicUpdate
35.6.19. 继承已存在的 Repository
35.6.20. Optional
35.6.21. stream 用法
35.7. TransactionTemplate
35.8. JPQL @Query
35.8.1. @Modifying 更新/删除
35.8.2. 参数传递
35.8.3. 原生 SQL 操作
35.8.4. @Query 与 Pageagble
35.8.5. 自定义返回字段
35.8.6. 返回指定字段
35.8.7. 返回指定的模型
35.8.8. 通过定义接口,返回指定字段
35.8.9. 修改返回数据
35.8.10. 事务 @Transactional
35.8.11. IN / NOT 子查询
35.9. FAQ 常见问题
35.9.1. Could not write JSON: failed to lazily initialize a collection of role
35.9.2. Query did not return a unique result: 2 results were returned
35.9.3. Executing an update/delete query
35.9.4. could not initialize proxy [cn.netkiller.domain.Device#16] - no Session
35.9.5. this is incompatible with sql_mode=only_full_group_by
35.9.6. A TupleBackedMap cannot be modified
36. Spring Data with Redis
36.1. 集成 Redis XML 方式
36.1.1. pom.xml
36.1.2. springframework-servlet.xml
36.1.3. Controller
36.1.4. index.jsp
36.1.5. 测试
36.2. 通过构造方法实例化 Redis
36.3. StringRedisTemplate 基本用法
36.3.1. 存储数据
36.3.2. 获取值并删除
36.3.3. 取出数据
36.4. RedisTemplate
36.4.1. 设置缓存时间
36.4.2. increment
36.4.3. 删除 key
36.4.4. 对象存储
36.4.5. 获取过期时间
36.4.6. 过期时间未执行
36.4.7. 判断 key 是否存在
36.5. ValueOperations
36.5.1. 字符串截取
36.5.2. 追加字符串
36.5.3. 设置键的字符串值并返回其旧值
36.5.4. 返回字符串长度
36.5.5. 如果key不存便缓存。
36.5.6. 缓存多个值 /获取多个值 multiSet / multiGet
36.5.7. setBit / getBit 二进制位操作
36.6. 列表操作
36.6.1. rightPush
36.6.2. rightPushAll
36.6.3. rightPushIfPresent
36.6.4. leftPush
36.6.5. leftPushAll
36.6.6. range
36.7. SetOperations 数据类型
36.7.1. 返回集合中的所有成员
36.7.2. 取出一个成员
36.7.3. 随机获取无序集合中的一个元素
36.7.4. 随机获取 n 个成员(存在重复数据)
36.7.5. 随机获取 n 个不重复成员
36.7.6. 在两个 SET 间移动数据
36.7.7. 成员删除
36.7.8. 返回集合数量
36.7.9. 判断元素是否在集合成员中
36.7.10. 对比两个集合求交集
36.7.11. 对比两个集合求交集,然后存储到新的 key 中
36.7.12. 合并两个集合,并去处重复数据
36.7.13. 合并两个集合去重复后保存到新的 key 中
36.7.14. 计算两个合集的差集
36.7.15. 计算两个合集的差集,然后保存到新的 key 中
36.7.16. 遍历 SET 集合
36.8. ZSetOperations 有序的 set 集合
36.9. HashOperations
36.9.1. put
36.9.2. putAll
36.9.3. 从键中的哈希获取给定hashKey的值
36.9.4. delete
36.9.5. 确定哈希hashKey是否存在
36.9.6. 从哈希中获取指定的多个 hashKey 的值
36.9.7. 只有hashKey不存在时才能添加值
36.9.8. 获取整个Hash
36.9.9. 获取所有key
36.9.10. 通过 hashKey 获取所有值
36.9.11. 值加法操作
36.9.12. 遍历 Hash 表
36.10. 存储 Json 对象
36.10.1. 集成 RedisTemplate 定义新类 JsonRedisTemplate
36.10.2. 配置 Redis
36.10.3. 测试
36.11. Spring Data Redis - Repository Examples
36.11.1. @EnableRedisRepositories 启动 Redis 仓库
36.11.2. 定义 Domain 类
36.11.3. Repository 接口
36.11.4. 测试代码
36.12. Redis Pub/Sub
36.12.1. MessageListener 方案
36.12.2. @RedisListener 注解方案
36.12.3. 线程池
36.13. CacheService
36.14. FAQ
36.14.1. Spring Data Redis
37. Spring Data with MongoDB
37.1. Example Spring Data MongoDB
37.1.1. pom.xml
37.1.2. springframework-servlet.xml
37.1.3. POJO
37.1.4. Controller
37.1.5. 查看测试结果
37.1.6. 条件查询
37.2. MongoDB 多数据源
37.2.1. Maven
37.2.2. Application 禁止自动配置 MongoDB
37.2.3. application.properties 新增配置项
37.2.4. MongoDB 配置类
37.2.5. 创建 Document 关系映射类
37.2.6. 测试控制器
37.2.7. 测试
37.3. @Document
37.3.1. 指定表名
37.3.2. @Id
37.3.3. @Version
37.3.4. @Field 定义字段名
37.3.5. @Indexed
37.3.6. @CompoundIndex 复合索引
37.3.7. @TextIndexed
37.3.8. @GeoSpatialIndex 地理位置索引
37.3.9. @Transient 丢弃数据,不存到 mongodb
37.3.10. @DBRef 做外外键引用
37.3.11. @DateTimeFormat
37.3.12. @NumberFormat
37.3.13. 在 @Document 中使用 Enum 类型
37.3.14. 在 @Document 中定义数据结构 List/Map
37.3.15. GeoJson 数据类型
37.4. MongoRepository
37.4.1. 扫描仓库接口
37.4.2. findAll()
37.4.3. deleteAll()
37.4.4. save()
37.4.5. count()
37.4.6. exists() 判断是否存在
37.4.7. existsById()
37.4.8. findByXXXX
37.4.9. findAll with OrderBy
37.4.10. findAll with Sort
37.4.11. FindAll with Pageable
37.4.12. StartingWith 和 EndingWith
37.4.13. Between
37.4.14. Before / After
37.4.15. @Query
37.5. mongoTemplate
37.5.1. Save 保存
37.5.2. Insert
37.5.3. updateFirst 修改符合条件第一条记录
37.5.4. updateMulti 修改符合条件的所有
37.5.5. 查找并保存
37.5.6. upsert - 修改符合条件时如果不存在则添加
37.5.7. 删除
37.5.8. 查找一条数据
37.5.9. 查找所有数据
37.5.10. Query
37.5.11. Criteria
37.5.12. Update
37.5.13. BasicUpdate
37.5.14. Sort
37.5.15. Query + PageRequest
37.5.16. newAggregation
37.5.17. 创建索引
37.5.18. 子对象操作
37.6. GeoJson 反序列化
37.7. FAQ
37.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
38. Spring Data with Elasticsearch
38.1. 内嵌 Elasticsearch
38.1.1. Maven
38.1.2. src/main/resources/application.properties
38.1.3. Domain Class
38.1.4. ElasticsearchRepository
38.1.5. SearchRestController
38.1.6. 测试
38.2. 集群模式
38.3. Document
38.4. Elasticsearch 删除操作
38.5. FAQ
38.5.1. java.lang.IllegalStateException: Received message from unsupported version: [2.0.0] minimal compatible version is: [5.0.0]
39. Spring boot with Data restful
39.1. Maven
40. Apache ShardingSphere
40.1. 微服务集群环境,雪花算法出现重复ID
40.1.1. 方案一、配置实现
40.1.2. 方案二、代码实现
VI. Spring Security
41. Springboot 3 + Security 6
41.1. Spring Security with HTTP Auth
41.1.1. 默认配置
41.1.2. 设置用户名和密码
41.1.3. 禁用 Security
41.1.4. 设置角色
41.2. Springboot 3 Security + OncePerRequestFilter
41.2.1. OncePerRequestFilter
41.2.2. SecurityConfiguration
41.3. SecurityFilterChain
41.4. @PreAuthorize
41.4.1. hasRole
41.4.2. hasAnyRole
41.4.3. 从 HttpServletRequest 返回的 request 变量中判断角色
41.4.4. getAuthentication() 获得角色
41.4.5. UserDetailsService
41.5. httpBasic 配置
41.5.1. 禁止 HTTP Auth
41.6. 指定 URL 限制 IP 访问
41.7. Authorization Bearer
41.8. InvalidClaimException: The Token can't be used before
42. Spring Authorization Server
42.1. Oauth2 协议
42.1.1. token
42.1.2. grant_type
42.1.3. 授权码授权模式(Authorization Code Grant)
42.1.4. 密码模式(Resource Owner Password Credentials Grant)
42.1.5. 客户端凭证模式(Client Credentials Grant)
42.1.6. 刷新 TOKEN 方式
42.2. Maven 依赖
42.3. Spring cloud with Oauth2
42.3.1. authorization_code
42.3.2. Spring boot with Oauth2 - Password
42.3.3. Spring boot with Oauth2 jwt
42.3.4. Spring boot with Oauth2 jwt 非对称证书
42.3.5. Apple iOS 访问 Oauth2
42.3.6. Oauth2 客户端
42.3.7. Android Oauth2 + Jwt example
42.3.8. RestTemplate 使用 HttpClient
42.3.9. 自签名证书信任问题
42.3.10. Principal
42.3.11. SecurityContextHolder 对象
42.3.12. 资源服务器配置
42.3.13. Client
42.3.14. Oauth2 常见问题
43. Spring boot with Spring security(2.x)
43.1. Spring security 静态配置例子
43.1.1. Maven
43.1.2. Reource
43.1.3. Application
43.1.4. WebSecurityConfigurer
43.1.5. RestController
43.1.6. 测试
43.2. Spring + Security + MongoDB
43.2.1. Account
43.2.2. AccountRepository
43.2.3. WebSecurityConfiguration
43.3. Spring Boot with Web Security(2.x)
43.3.1. EnableWebSecurity
43.3.2. Web静态资源
43.3.3. 正则匹配
43.3.4. 登陆页面,失败页面,登陆中页面
43.3.5. CORS
43.3.6. X-Frame-Options 安全
43.4. 访问控制列表(Access Control List,ACL)
43.4.1. antMatchers
43.4.2. HTTP Auth
43.4.3. Rest
43.4.4. hasRole
43.4.5. hasAnyRole()
43.4.6. withUser
VII. Spring Cloud
44. 云服务
44.1. 讯飞云
44.1.1. AIUI
44.1.2. 讯飞 TTS
44.1.3. 语音唤醒
44.2. 阿里云
44.2.1. nuisdk-release.aar 版本问题
44.2.2. 获取 Token
44.2.3. 语音唤醒
44.2.4. CosyVoice 语音合成
45. Spring Integration
45.1. Spring Redis Lock
45.1.1. Maven 依赖
45.1.2. 配置锁
45.1.3. 使用方法
45.1.4. Service 中使用方法
45.1.5. 在定时任务中使用
45.1.6. 在Controller中使用
45.1.7. 使用模板方法模式封装
45.1.8. 读取锁过期时间
45.2. MQTT Support
45.2.1. 入站消息通道适配器
45.2.2. 出站通道适配器
45.2.3. @MessagingGateway 定义消息网管接口
45.2.4. 手动 ACK 应答
45.2.5. Spring boot with Mqtt v5
46. MyBatis
46.1. Mybatis 入门
46.2. 接口注解
47. Apache Struts
47.1. struts.xml
47.1.1. include
47.2. Struts Tags
47.2.1. property
47.2.2. set
47.2.3. url
47.2.4. s:include
47.2.5. s:action
47.2.6. HTML Form
47.2.7. iterator
47.2.8. if elseif else
47.3. Action
47.3.1. redirect
47.3.2. redirectAction
47.3.3. JSON
47.3.4. 传递 Timestamp 变量
47.4. Ajax + JSON
47.4.1. GET/POST JSON
47.5. Json 内容展示
47.5.1. 禁止方法
47.5.2. 格式化日期
47.5.3. 重命名变量名
47.5.4. org.apache.struts2.json
47.6. Interceptor
47.6.1. Session
47.7. Action 中使用线程
47.8. 日志
47.9. FAQ
47.9.1. Struts 怎样判断用户来自电脑还是移动设备
48. Apache Tiles
48.1. 配置 Tiles
48.1.1. Maven
48.1.2. web.xml
48.2. Template 配置模板
48.3. Struts tiles
49. Play
50. Servlet
50.1. Example
50.2. Session
50.3. HttpServletRequest
50.4. Filter
50.4.1. web.xml
50.4.2. Filter 类
50.5. Listener
50.5.1. web.xml
50.5.2. NewsListener 类
50.5.3. NewsTask 类
50.5.4. JSP 中心显示
50.6. JSP
50.6.1. 注释
50.6.2. pageContext
50.6.3. request
50.6.4.
50.6.5. cookie
50.6.6. session
50.6.7. page
50.6.8. trimDirectiveWhitespaces
50.6.9. include
50.6.10. jsp
50.6.11. error-page
50.6.12. JSP 编程
50.6.13. FAQ
50.7. JSTL(JavaServer Pages Standard Tag Library)
50.7.1. c:set
50.7.2. c:out
50.7.3. c:url
50.7.4. c:redirect
50.7.5. c:import
50.7.6. c:if
50.7.7. c:choose
50.7.8. c:forEach
50.7.9. empty 判断是否为空
50.7.10. JSTL fmt Tag setBundle Example
50.8. WebSocket
50.8.1. Server
50.8.2. Client
51. Log
51.1. Logback
51.1.1. Maven 包
51.1.2. Example
51.2. slf4j
51.3. log4j
51.3.1. 安装 Log4j
51.3.2. log4j 环境变量
51.3.3. Log4j Example
51.3.4. log4j.properties
52. AMQP(Advanced Message Queuing Protocol)
52.1. Send and Recv
52.2. direct
53. NoSQL
53.1. MongoDB
53.1.1. pom.xml
53.1.2. 插入操作
53.1.3. 读取操作
54. Elasticsearch API
54.1. Client
54.2. insert
54.3. Get
54.4. delete
54.5. Search
54.6. Query 查询
54.6.1. match all 匹配所有数据
54.6.2. match 匹配查询
54.6.3. match phrase 短语精准匹配
54.7. Filter 过滤
54.7.1. term
54.7.2. range
54.8. Sorting
54.9. 返回 Source 字段
54.10. Count
54.11. Example 范例
54.11.1. Spring boot 案例
54.12. FAQ
54.12.1. 显示查询 JSON 字符串
55. Jersey - RESTful Web Services in Java.
55.1. Client 2.x
55.1.1. Maven 版本
55.1.2. GET 操作
55.1.3. GET + Auth 用户认证
55.2. Client 1.x
55.2.1. Jersey + Auth + HTTP2 + SSL
56. Apache HttpComponents
56.1. org.apache.commons.lang3
56.1.1. HTML 标签处理
56.1.2. StringUtils.join 使用特定字符链接字符串
56.1.3. RandomStringUtils
56.2. commons-text
56.2.1. 禁止转译 json
56.3. Apache HttpClient
56.3.1. Maven
56.3.2. HTTP POST 操作
56.3.3. HTTPS
56.3.4. HTTP/2
56.3.5. Java11
56.3.6. Host name 'api.netkiller.cn' does not match the certificate subject provided
56.3.7. HttpStatus
56.3.8.
57. Cache
57.1. java memcached client
57.2. Jedis
57.2.1. 认证
57.2.2. jedis.keys
57.3. Ehcache
58. Kafka
58.1. 安装 Kafka 环境
58.2. Maven
58.3. 启动 kafka
58.4. 入门例子
58.4.1. 订阅例子
58.4.2. 发布例子
58.5. 线程例子
59. Software Development Kit
59.1. JAVE(Java Audio Video Encoder)
59.2. Google
59.2.1. com.google.gson
59.2.2. Guava
59.3. Mahout
59.3.1. 推荐系统
59.4. Hessian
59.5. quartz-scheduler
59.6. Redisson
VIII. Android
60. Android Studio
60.1. 卸载 Android Studio
60.2. 代码格式化
60.3. 设置兼容最低SDK版本
60.4. SDK Tools
60.4.1. 接受 License
60.4.2. 查看 SDK 列表
60.4.3. 按照 Android SDK
60.5. 命令行操作
60.6. adb 命令
60.6.1. 获得 root 权限
60.6.2. 设备管理
60.6.3. Shell
60.6.4. 设备 ID
60.6.5. 查看安卓版本
60.6.6. Logcat
60.6.7. 上传文件
60.6.8. 下载文件
60.6.9. 安卓 .apk bk
60.6.10. 屏幕尺寸
60.6.11. dump 系统信息
60.6.12. 解锁
60.6.13. 蓝牙管理
60.6.14. 声卡
60.6.15. 摄像头
61. AndroidManifest.xml
61.1. SDK 版本配置
61.2. 开启网络
61.3. 文件存储权限
61.4. 相机权限
61.5. GPS 定位权限
61.6. 全屏-无标题
61.7. 设置为默认开机启动
61.8. 开机启动
61.9. 默认横屏
61.10. 禁止屏幕旋转变化
62. 设备
62.1. 环境变量
62.1.1. 扩展存储
62.1.2. 下载缓存目录
62.1.3. 数据目录
62.2. 配置文件
62.2.1. *.properties 文件
62.2.2. 再 AndroidManifest.xml 使用 meta-data element 定义
62.2.3. 再 build.gradle 文件中配置 productFlavors
62.2.4. 从 assets 目录读取配置文件
62.3. 设备信息
62.4. Physical density
62.5. 声卡
62.5.1. 播放
62.5.2. 录音
62.5.3. 查看声卡信息
62.5.4. /proc/asound 设备信息
62.5.5. 查看声卡当前占用设备
62.5.6. tinymix 设置声卡参数
62.5.7. 麦克风阵列调试
62.6. 判断是平板,还是手机
62.7. 蓝牙设备管理
62.7.1. 进入蓝牙设置界面
62.7.2. 通过发送广播处理蓝牙
62.7.3. 蓝牙禁用/启用
62.7.4. 获取蓝牙设备
62.7.5. 查询已绑定设备
62.8. USB 设备
62.8.1. USB 音频设备
63. Activity
63.1. 界面佈局
63.1.1. setContentView
63.1.2. 隐藏虚拟键
63.1.3. 保持屏幕常开
63.1.4. 标题栏添加返回按钮
63.2. 切换 Activity
63.2.1. startActivity()
63.2.2. App 间跳转
63.2.3. intentActivityResultLauncher 跳转
63.2.4. startActivityForResult 替代方案
63.3. 生命周期
63.3.1. 定时关闭
63.3.2. 恢复触发
63.3.3. 返回触发
63.3.4. Activity 关闭
63.3.5. 重启自己
63.4. Activity 间数据传递
63.4.1. Intent 方式
63.4.2. Bundle 方式
63.4.3. Flag 属性
63.4.4. 返回值
63.5. DataBinding
63.5.1. 启用 DataBinding
63.5.2. MainActivity 中使用 ActivityMainBinding
63.5.3. ViewDataBinding 例子
63.6. 键盘事件
63.6.1. onKeyDown 键盘按下事件
63.6.2. dispatchKeyEvent
63.6.3. 屏蔽 KeyEvent.KEYCODE_BACK
63.6.4. 判断按下次数
63.7. 鼠标事件
63.8. 分享
63.8.1. 分享文本内容
63.8.2. 分享图片
63.8.3.
63.9. 剪切板
63.10. 软键盘控制
63.11. 自定义事件
63.11.1. 按钮点击事件
63.11.2. OnCheckedChangeListener
63.11.3. CustomOnItemSelectedListener
63.11.4. CustomOnScrollListener
63.11.5. CustomOnTabSelectedListener
63.12. Res 资源
63.12.1. 通过名称查找 layout ID
63.12.2. 查找 drawable 资源 ID
63.12.3. 获取 color 颜色 ID
63.12.4. 获取 array.xml 文件下某个字段的 ID
63.12.5. 获取 style.xml 文件下的某个样式的 id
63.12.6. 主题 themes.xml
64. Fragment
64.1. 启动 Fragment
64.2. 关闭 Fragment
64.3. 在 Fragment 中使用 findViewById
64.4. 在 Fragment 跳转 Activity
64.5. 在 Fragment 跳转 Activity 同时携带 Intent 参数
64.6. Fragment 中调用 getPackageManager()
64.7. 在 Fragment 中使用 runOnUiThread
64.8. Fragment 中调用 findViewById
64.9. 替换 FrameLayout
64.10. Fragment 接收 BroadcastReceiver 广播
64.11. Fragment 加载报错 java.lang.IllegalArgumentException: No view found for id ...
64.12. 使用 TabLayout 切换 Fragment
65. Resources
65.1. strings.xml
65.1.1. 字符串
65.1.2. 定义数组
65.1.3. 获取 Resource
65.1.4. Fragment 获取 Resource
65.2. dimens.xml
66. Palette 视觉设计
66.1. 禁止屏幕休眠
66.2. 颜色设置
66.2.1. 颜色设置
66.3. 样式布局
66.3.1. ConstraintLayout
66.3.2. LinearLayout
66.3.3. FrameLayout
66.3.4. 声音波形图
66.4. UI 界面
66.4.1. Toast
66.4.2. Dialog
66.4.3. DatePicker
66.4.4. Snackbar - Toast 的替代者
66.5. Text
66.5.1. Text 相关属性
66.5.2. TextView
66.5.3. EditText
66.5.4. 光标移动到行尾
66.5.5. 禁止选择文本
66.5.6. 设置 app:backgroundTint
66.5.7. 禁止滚动条
66.6. Button
66.6.1. 启用禁用
66.6.2. 实现 OnClickListener 接口
66.6.3. Fragment 中使用 Button
66.6.4. 圆形按钮
66.6.5. ImageButton
66.6.6. 添加悬浮操作按钮
66.7. Switch
66.8. Widgets
66.8.1. ImageView
66.8.2. TextClock
66.8.3. 进度条
66.8.4. NestedScrollView +
66.9. Containers
66.9.1. CardView
66.9.2. RecyclerView
66.9.3. NavigationView
66.9.4. 底部导航
66.9.5. TabLayout
66.9.6. ViewPager2
66.9.7. Navigation
66.10. 屏幕
66.10.1.
66.10.2. 媒体路由
66.10.3. 分辨率
66.10.4. 尺寸
66.10.5. 全屏显示
66.10.6. 音频处理
66.10.7. 屏幕触摸事件 onTouch(View view, MotionEvent motionEvent)
66.10.8. 手势事件
66.10.9. SimpleOnGestureListener
66.10.10. SimpleOnScaleGestureListener
66.11. 带有小三角指示的消息框
66.11.1. 左侧三角
66.11.2. 右侧三角
66.11.3. 正三角
66.11.4. 倒三角
66.11.5. 文本边框
66.11.6. 布局
67. Schedule 计划任务
67.1. 使用 Runnable 和 Handler 实现定时执行
67.1.1. 循环执行
67.1.2. 延迟执行
67.2. TimerTask 实现循环播放
67.2.1. Time 和 TimerTask 定时刷新
67.2.2. TimerTask 更新 UI
67.3. ScheduledExecutorService
68. Internationalization i18n with Android (国际化)
68.1. 创建国际化文件
68.2. strings.xml 文件
68.3. 翻译语言
68.4. 引用国际化文件
68.5. 切换语言
69. 存储
69.1. 获得存储目录
69.1.1. 用户存储目录
69.1.2. Assets 目录
69.1.3. 公共存储目录
69.1.4. 内部存储
69.1.5. 扩展存储
69.1.6. 文件夹类型
69.2. FileProvider 配置
69.3. SD Card
69.3.1. SD Card 状态
69.3.2. Android 11 申请 sdcard 权限
69.4. 下载管理
69.4.1. 从 URL 下来文件
69.4.2. 安装 APK
69.4.3. 下载后接收广播通知
69.5. android.os.FileUriExposedException
69.6. 下载工具类
70. 网络
70.1. Wifi 配置
70.2. WI-FI 与 蜂窝网络 信号强度检测
70.3. OkHttp - An HTTP & HTTP/2 client for Android and Java applications
70.3.1. Gradle
70.3.2. AndroidManifest.xml 开启网络访问权限
70.3.3. okhttp 默认是 HTTPS 开启 HTTP
70.3.4. 连接池
70.3.5. HttpUrl
70.3.6. GET
70.3.7. POST
70.3.8. HTTP PUT 请求
70.3.9. http header 相关设置
70.3.10. HTTP Base Auth
70.3.11. HttpUrl.Builder 组装 URL 地址参数
70.3.12. Android Activity Example
70.3.13. Android Oauth2 + Jwt example
70.3.14. HTTP/2
70.3.15. 异步更新 UI
70.3.16. SSE 客户端
70.3.17. WebSocket Client
70.3.18. EventListener
70.3.19. 文件下来
70.4. Retrofit - https://github.com/square/retrofit
70.4.1. Gradle 依赖
70.4.2. Authorization 头
71. 相机与相册
71.1. 调用相机
71.1.1. manifest 文件
71.1.2. layout
71.1.3. Activity
71.2. 相机开发
71.2.1. 页面布局
71.2.2. 相机逻辑功能
71.3. LED flash 做手电筒
72. 多媒体开发
72.1. AudioDeviceInfo
72.2. MediaPlayer
72.2.1. 播放Raw下的元数据
72.2.2. 播放assets文件夹中的音乐
72.2.3. 播放互联网音乐
72.2.4. 使用单例模式
72.2.5. 设置速度,快进播放
72.2.6. OPUS
72.3. AudioPlayer
72.4. AudioTrack
72.5. VideoView 开发
72.5.1. 播放网络视频
72.5.2. MediaController 添加翻页事件
72.5.3. 静音播放视频
72.5.4. 更新进度条
72.5.5. 完整的例子
72.5.6. 循环播放
72.5.7. 静音播放
72.6. SoundPool
72.7. 音量控制
72.8. 麦克风
72.8.1. AudioRecord
72.8.2. 远端录音
72.8.3. 选择麦克风
72.8.4. 设置蓝牙麦克风为默认麦克风
72.8.5. 录音例子
72.8.6. Microphone 录音,蓝牙,增益
72.9. 麦克风与录音例子
72.9.1. 开启麦克风和SD卡权限
72.9.2. layout
72.9.3. Activity
72.10. MediaRecorder 录音例子
72.11. MediaCodec
72.12. ExoPlayer
72.12.1. Opus
72.13. Opus
72.13.1. Kopus - A Kotlin Multiplatform library providing OPUS audio codec functionality for Android and iOS platforms.
73. 定位
73.1. GPS + 网络 定位
73.1.1. manifest 权限配置
73.1.2. layout
73.1.3. Activity
73.2. 只从 GPS 获取定位
74. 电话
74.1. SIM 卡状态
74.2. 通信录与拨打电话
74.3. 发送短信
75. 消息广播
75.1. 动态注册
75.2. 静态注册
75.2.1. 电源管理
75.2.2. 接收不到消息
75.2.3. StaticBroadcastReceiver 完整的例子
75.3. 自定义用户消息广播
75.4. 本地广播
75.5. 动态监听广播
75.6. 广播重复接收
75.7. 指定静态广播接收者
75.8. 异步执行广播
75.9. 静态广播接收不到信息
75.10. 接受蓝牙广播
75.11. 接收 USB 设备广播
75.11.1.
75.12. Wifi 广播
75.13. LiveDataBus - 官方 AndroidX jetpack
76. Service 服务
76.1. Service的基本用法
76.1.1. manifest 文件
76.1.2. 创建 Service
76.1.3. Layout 代码
76.1.4. Activity 代码
76.2. bindService
76.3. Service 中启动线程
76.4. Service 和 Activity 通信
76.4.1. Layout
76.4.2. Service
76.4.3. Activity
76.5. Service 和 Toast
76.6. Service 中启动 Activity
76.7. Service 中更新 UI
76.8. 前台启动 Service
76.9. 在 Fragment 中启动 Service
77. Android 多线程
77.1. Thread
77.1.1. 线程名称
77.1.2. 线程名称
77.1.3. Sleep
77.2. Handler
77.3. HandlerThread
77.3.1. Handler post
77.3.2. 发送消息
77.3.3. 完整例子
77.3.4. 获取线程名称
77.3.5. HandlerThread 队列
77.3.6. Token 应用
77.4. 消息队列
77.4.1. 非阻塞队列 ConcurrentLinkedQueue
78. Notification 通知中心
78.1. 文本通知
78.2. 添加点击操作
78.3. Notification 给 Activity 传值
78.4. 通过 isNotification 判断是否需要执行 onStop() 和 onDestroy()
79. NFC (Near field communication)
79.1. AndroidManifest.xml 文件配置
79.2. Loyout 文件
79.3. Activity 文件
80. 图形开发
80.1. Paint
80.1.1. Paint.setTextSize() SP to PX
80.2. AnimationDrawable
80.3. 矩形
80.4. 路径
81. EventBus
81.1. 添加 EventBus 依赖到项目Gradle文件
81.2. 快速开始一个演示例子
81.2.1. 创建 MessageEvent 类
81.2.2. Layout
81.2.3. Activity
81.3. Sticky Events
81.3.1. MainActivity
81.3.2. StickyActivity
81.3.3. MessageEvent
81.3.4. 删除粘性事件
81.4. 线程模型
81.5. 配置 EventBus
81.6. 事件优先级
81.7. 捕获异常事件
82. Android MQTT
82.1. build.gradle 添加依赖包
82.2. AndroidManifest.xml
82.3. Android Mqtt v5 例子
83. 数据库
83.1. SharedPreferences
83.1.1. 操作模式
83.1.2. 保存数据
83.1.3. 读取数据
83.1.4. 通过 key 查询数据是否存在
83.1.5. 删除数据
83.1.6. 清空数据
83.1.7. 对象存储
83.1.8. SharedPreferences 读取物理存储文件
83.2. Room
83.2.1. 快速开始并掌握 Room 数据库
83.2.2. 组合唯一索引
83.3. Preferences DataStore
83.4. Proto DataStore
84. 杂项
84.1. Caused by: java.net.UnknownServiceException: CLEARTEXT communication to 47.100.253.187 not permitted by network security policy
84.2. 设计模式
84.2.1. 单例模式
84.3. Android OS 包
84.3.1. 进程ID
84.3.2. handler
84.4. fastjson android
84.4.1. 对象转字符串
84.4.2. JsonObject 转对象
84.4.3. 字符串 与 json 互转
84.4.4. json 转 数组
84.4.5. JSON数组转List
84.4.6. Map 与 Json 互转
84.5. Butter Knife
84.6. Android Things
84.6.1. GPIO
85. FAQ
85.1. java.net.UnknownServiceException: CLEARTEXT communication to 192.168.0.185 not permitted by network security policy
85.2. Caused by: android.os.NetworkOnMainThreadException
85.3. java.lang.IllegalStateException: Player is accessed on the wrong thread.
85.4. Manifest merger failed with multiple errors, see logs
85.5. android.os.NetworkOnMainThreadException
85.6. package does not have vibrate permission
85.7. Can't create handler inside thread Thread[...,5,main] that has not called Looper.prepare()
85.8. java.lang.SecurityException: Permission denied (missing INTERNET permission?)
85.9. java.io.IOException: Cleartext HTTP traffic to **** not permitted
85.10. 调试技巧,找不到哪里调用
86. 从 Java 到 Kotlin
86.1. 数据类型与数据结构
86.1.1. 字符串
86.1.2. 日期时间
86.1.3. 数组
86.1.4. List 列表
86.1.5. Map 图
86.1.6. let
86.2. Class
86.2.1. 枚举
86.3. 流程控制
86.3.1.
86.3.2. 循环
86.4. Callback 回调
86.4.1. Consumer
86.4.2. callback
86.4.3. 定义接口方式
86.5. 界面操作
86.5.1. findViewById
86.5.2. runOnUiThread
86.5.3. Fragment
86.5.4. ImageView
86.6. Thread
86.6.1. Handler
86.6.2.
86.7. 定时与延迟执行
86.7.1. Timer
86.7.2.
86.8. MutableLiveData
86.8.1. MutableLiveData 使用 Pair 传 key, value 两个值
86.8.2. MutableLiveData 传自定义对象
86.9. Flow
86.9.1. MutableSharedFlow
86.10. 协程
86.10.1. GlobalScope
86.10.2. MainScope
86.10.3. lifecycleScope
86.10.4.
86.10.5. viewModelScope
86.10.6. 协程上下文与继承关系
87. 云服务
87.1. 讯飞云
87.1.1. AIUI
87.1.2. 讯飞 TTS
87.1.3. 语音唤醒
87.2. 阿里云
87.2.1. nuisdk-release.aar 版本问题
87.2.2. 获取 Token
87.2.3. 语音唤醒
87.2.4. CosyVoice 语音合成
1. 附录
1.1. 一致性算法

表格清单

1. Netkiller 系列免费电子书

范例清单

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
26.1. Example Spring boot with Oracle
26.2. RedisTemplate
26.3. Spring boot with Apache kafka.
26.4. Spring boot with Apache kafka.
26.5. Test Spring Kafka
26.6. Spring boot with Email (pom.xml)
28.1. Spring boot with Velocity template (pom.xml)
31.1. MyBatis
35.1. JPA deleteBy 返回删除数量
35.2. JPA 更多用法
36.1. Spring Data Redis Example
37.1. Spring Data MongoDB - springframework-servlet.xml
57.1. memcached.java
67.1.