{"id":20078041,"url":"https://github.com/cn-src/snippets-java","last_synced_at":"2026-05-17T00:39:26.793Z","repository":{"id":46286016,"uuid":"276255960","full_name":"cn-src/snippets-java","owner":"cn-src","description":"Java 代码片段 \u0026 Spring Boot 集成","archived":false,"fork":false,"pushed_at":"2021-11-02T06:03:11.000Z","size":1619,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-02T13:52:12.941Z","etag":null,"topics":["demo","eclipse-collections","exception","jooq","kryo","p6spy","spring-boot","spring-data","spring-data-jdbc"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cn-src.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-01T02:20:32.000Z","updated_at":"2021-11-26T11:28:25.000Z","dependencies_parsed_at":"2022-08-29T17:31:36.969Z","dependency_job_id":null,"html_url":"https://github.com/cn-src/snippets-java","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/cn-src/snippets-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cn-src%2Fsnippets-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cn-src%2Fsnippets-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cn-src%2Fsnippets-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cn-src%2Fsnippets-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cn-src","download_url":"https://codeload.github.com/cn-src/snippets-java/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cn-src%2Fsnippets-java/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274932148,"owners_count":25376088,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-13T02:00:10.085Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["demo","eclipse-collections","exception","jooq","kryo","p6spy","spring-boot","spring-data","spring-data-jdbc"],"created_at":"2024-11-13T15:12:32.201Z","updated_at":"2026-05-17T00:39:21.763Z","avatar_url":"https://github.com/cn-src.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n![CI](https://github.com/cn-src/snippets-java/workflows/CI/badge.svg)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/91008f90f9c24f7f985384a26fc74987)](https://www.codacy.com/gh/cn-src/snippets-java/dashboard?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=cn-src/snippets-java\u0026amp;utm_campaign=Badge_Grade)\n[![codecov](https://codecov.io/gh/cn-src/snippets-java/branch/master/graph/badge.svg)](https://codecov.io/gh/cn-src/snippets-java)\n[![](https://jitpack.io/v/cn-src/snippets-java.svg)](https://jitpack.io/#cn-src/snippets-java)\n![Lines of code](https://img.shields.io/tokei/lines/github/cn-src/snippets-java)\n[![Java Version](https://img.shields.io/badge/Java-8%20|%2011%20|%2015-blue)](https://adoptopenjdk.net/)\n\n***\n\n# Snippets Java\n\n\u003e 随时提炼一些 Java 代码片段，直接集成使用。\n***\n\n## jOOQ 扩展\n\n* 使用 `ConditionBuilder` 可动态构建 where 条件\n* 使用 `ConditionCreator` 和 `@Condition` 系列注解可构建样例查询\n* 使用 `cn.javaer.snippets.jooq.PGDSL` 扩展支持了 PostgreSQL 相关函数\n* 使用 `Geometry` 简单支持了几何对象\n* 使用 `JsonbField` 扩展 PostgreSQL 的 JSONB 支持\n* 使用 `SimpleJooqJdbcRepository` 将 jOOQ 和 Spring Data JDBC 集成\n* `@DataJooqJdbcTest` JooqJdbcRepository 测试支持\n* `SnippetsGenerator` `TablesGenerator` jOOQ 自带代码生成器扩展\n* `CodeGenTool` 全新的 jOOQ 代码生成器，无需链接数据库，基于实体类生成，支持 spring data 注解\n\n## easy-batch 扩展\n\n* 增加时间增量同步\n* 同步记录持久化到数据库\n* 实时监控信息\n\n## jackson\n\n* 使用 `cn.javaer.snippets.spring.jackson.Json` 便捷的 JSON 工具\n* 支持 jOOQ 相关类型的序列化\n\n## Kryo 序列化\n\n* 支持 Eclipse Collections 集合序列化支持\n* 支持不可变 POJO 对象序列化\n* 使用 `KryoPool` Kryo 对象池\n\n## 日期格式化扩展\n\n* 自定义 `@DateFillFormat`, `@DateMaxTime`, `@DateMinTime` 等日期格式化注解，可自动填充时间部分和日期偏移\n* 支持 spring 和 jackson\n\n## Tree 模型\n\n* `TreeNode` 支持树状结构，主要用于 UI 的树结构相关组件\n* 支持与 POJO 的互相转换\n\n## 组合模型\n\n\u003e 如果遵循严格的不可变对象设计，但有时候需要附加属性或对象时。\n\u003e 组合模型可以存放对象和附加属性或对象，在 JSON 序列化时如同序列化成一个对象。\n\u003e 受 jackson `@JsonUnwrapped` 注解的限制，组合对象只适用于序列化，不适用于反序列化。\n\u003e 配合 `MergeUtils` 使用。\n\n* `Assembler` 组合对象\n* `DynamicAssembler` 组合动态对象\n* `Creator` 添加 `createdBy` 属性对象\n* `Auditor` 添加 `updatedBy` `createdBy` 属性对象\n\n## p6spy SQL日志扩展\n\n* p6spy 是驱动级别的统一输出 SQL 日志，无论你混合使用何种基于 JDBC 的框架\n* p6spy 可输出填充 SQL 参数的 SQL 日志\n* 复制使用 hibernate 的一个源码，扩展了 p6spy 使 SQL 日志带缩进的漂亮格式化\n\n## SpringDoc\n\n* 扩展 Pageable 和 Page 支持\n* 扩展支持 Controller 的异常声明来自动生成异常响应文档\n\n## Spring\n\n* 自定义更便捷的 Spring 事务注解，默认 `rollbackFor = Throwable.class` 来避免意外的受检查异常\n* 完善的 spring web 异常处理机制，消息国际化\n\n## Spring Data\n\n* 扩展 Eclipse Collections 支持，返回值可以使用 Eclipse Collections 的集合类型","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcn-src%2Fsnippets-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcn-src%2Fsnippets-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcn-src%2Fsnippets-java/lists"}