{"id":23155630,"url":"https://github.com/fishpioffical/rhy-latke","last_synced_at":"2026-02-26T03:57:36.826Z","repository":{"id":40253199,"uuid":"438832862","full_name":"FishPiOffical/rhy-latke","owner":"FishPiOffical","description":"latke for rhythm","archived":false,"fork":false,"pushed_at":"2024-11-27T11:56:03.000Z","size":297,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-13T13:15:36.621Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FishPiOffical.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-16T02:15:37.000Z","updated_at":"2024-11-27T11:56:07.000Z","dependencies_parsed_at":"2024-11-16T17:32:50.158Z","dependency_job_id":"5c27fb34-d399-4038-9695-236051622e24","html_url":"https://github.com/FishPiOffical/rhy-latke","commit_stats":null,"previous_names":["fishpioffical/rhy-latke"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FishPiOffical%2Frhy-latke","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FishPiOffical%2Frhy-latke/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FishPiOffical%2Frhy-latke/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FishPiOffical%2Frhy-latke/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FishPiOffical","download_url":"https://codeload.github.com/FishPiOffical/rhy-latke/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230181547,"owners_count":18185937,"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","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":[],"created_at":"2024-12-17T21:09:32.399Z","updated_at":"2026-02-26T03:57:36.750Z","avatar_url":"https://github.com/FishPiOffical.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align = \"center\"\u003e\n\u003cimg alt=\"Latke\" src=\"https://b3log.org/images/brand/latke-128.png\"\u003e\n\u003cbr\u003e\u003cbr\u003e\n一款以 JSON 为主的 Java Web 框架\n\u003cbr\u003e\u003cbr\u003e\n\u003ca title=\"Build Status\" target=\"_blank\" href=\"https://travis-ci.org/88250/latke\"\u003e\u003cimg src=\"https://img.shields.io/travis/88250/latke.svg?style=flat-square\"\u003e\u003c/a\u003e\n\u003ca title=\"MulanPSL2\" target=\"_blank\" href=\"https://license.coscl.org.cn/MulanPSL2\"\u003e\u003cimg src=\"http://img.shields.io/badge/license-MulanPSL2-orange.svg?style=flat-square\"\u003e\u003c/a\u003e\n\u003ca title=\"Maven Central\" target=\"_blank\" href=\"https://repo1.maven.org/maven2/org/b3log/latke-parent\"\u003e\u003cimg src=\"https://img.shields.io/maven-central/v/org.b3log/latke-parent?style=flat-square\u0026color=blueviolet\"\u003e\u003c/a\u003e\n\u003ca title=\"Hits\" target=\"_blank\" href=\"https://github.com/88250/hits\"\u003e\u003cimg src=\"https://hits.b3log.org/88250/latke.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/88250/latke/blob/master/README_en_US.md\"\u003eEnglish\u003c/a\u003e\n\u003c/p\u003e\n\n## 💡 简介\n\n[Latke](https://github.com/88250/latke)（'lɑ:tkə，土豆饼）是一个简单易用的 Java Web 应用开发框架，包含 MVC、IoC、事件通知、ORM、插件等组件。在实体模型上使用 JSON 贯穿前后端，使应用开发更加快捷。这是 Latke 不同于其他框架的地方，比较适合小型应用的快速开发。\n\n欢迎到 [Latke 官方讨论区](https://ld246.com/tag/latke)了解更多。同时也欢迎关注 B3log 开源社区微信公众号 `B3log开源`：\n\n![b3logos.jpg](https://b3logfile.com/file/2020/08/b3logos-032af045.jpg)\n\n## ✨ 特性\n\n* 函数式路由\n* 依赖注入\n* MySQL/H2 ORM\n* 多语言\n* 内存/Redis 缓存\n* 事件机制\n* 插件机制\n\n## 🗃 案例\n\n* [Demo](https://github.com/88250/latke-demo)：简单的 Latke 应用示例\n* [Solo](https://github.com/88250/solo)：一款小而美的 Java 开源博客系统，专为程序员设计\n* [Symphony](https://github.com/88250/symphony)：一款用 Java 实现的现代化社区（论坛/BBS/社交网络/博客）平台\n\n## 🛠️ 使用\n\n### Maven\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.b3log\u003c/groupId\u003e\n    \u003cartifactId\u003elatke-core\u003c/artifactId\u003e\n    \u003cversion\u003e${latke.version}\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### 控制器层用法\n\n**函数式路由**\n\n```java\nfinal Dispatcher.RouterGroup routeGroup = Dispatcher.group();\nrouteGroup.get(\"/\", helloProcessor::index).\n        get(\"/register\", registerProcessor::showRegister).\n        post(\"/register\", registerProcessor::register).\n        get(\"/var/{pathVar}\", registerProcessor::paraPathVar).\n        router().get().post().uri(\"/greeting\").handler(helloProcessor::greeting);\n```\n\n**JSON 解析**\n\n```java\nfinal JSONObject requestJSON = context.requestJSON();\n```\n\n**HTTP 封装**\n\n```java\nfinal String remoteAddr = context.remoteAddr();\nfinal String requestURI = context.requestURI();\nfinal Object att = context.attr(\"name\");\nfinal String method = context.method();\ncontext.sendRedirect(\"https://b3log.org\");\nfinal Request request = context.getRequest();\nfinal Response response = context.getResponse();\n```\n\n### 服务层用法\n\n**依赖注入、事务**\n\n```java\n@Service\npublic class UserService {\n\n    private static final Logger LOGGER = Logger.getLogger(UserService.class);\n\n    @Inject\n    private UserRepository userRepository;\n\n    @Transactional\n    public void saveUser(final String name, final int age) {\n        final JSONObject user = new JSONObject();\n        user.put(\"name\", name);\n        user.put(\"age\", age);\n\n        String userId;\n\n        try {\n            userId = userRepository.add(user);\n        } catch (final RepositoryException e) {\n            LOGGER.log(Level.ERROR, \"Saves user failed\", e);\n\n            // 抛出异常后框架将回滚事务\n            throw new IllegalStateException(\"Saves user failed\");\n        }\n\n        LOGGER.log(Level.INFO, \"Saves a user successfully [userId={0}]\", userId);\n    }\n}\n```\n\n### 持久层用法\n\n**构造 ORM**\n\n```java\n@Repository\npublic class UserRepository extends AbstractRepository {\n\n    public UserRepository() {\n        super(\"user\");\n    }\n}\n```\n\n**单表 CRUD**\n\n```java\npublic interface Repository {\n    String add(final JSONObject jsonObject) throws RepositoryException;\n    void update(final String id, final JSONObject jsonObject) throws RepositoryException;\n    void remove(final String id) throws RepositoryException;\n    void remove(final Query query) throws RepositoryException;\n    JSONObject get(final String id) throws RepositoryException;\n    long count(final Query query) throws RepositoryException;\n}\n```\n\n**条件查询**\n\n```java\npublic JSONObject getByName(final String name) throws RepositoryException {\n    return getFirst(new Query().setFilter(new PropertyFilter(\"name\", FilterOperator.EQUAL, name)));\n}\n```\n\n**分页查询**\n\n```java\nnew Query().setPage(1, 50)\n```\n\n**按字段排序**\n\n```java\nnew Query().addSort(\"name\", SortDirection.DESCENDING);\n```\n\n**仅获取需要字段**\n\n```java\nnew Query().select(\"name\", \"age\");\n```\n\n**原生 SQL**\n\n```java\nfinal List\u003cJSONObject\u003e records = select(\"SELECT * FROM `user` WHERE `name` = ?\", name);\n```\n\n## 📜 文档\n\n* [《提问的智慧》精读注解版](https://ld246.com/article/1536377163156)\n* [Latke 一款以 JSON 为主的 Java Web 框架](https://ld246.com/article/1574210028252)\n* [为什么又要造一个叫 Latke 的轮子](https://ld246.com/article/1403847528022)\n* [Latke 快速上手指南](https://ld246.com/article/1466870492857)\n* [Latke 配置剖析](https://ld246.com/article/1474087427032)\n\n## 🏘️ 社区\n\n* [讨论区](https://ld246.com/tag/latke)\n* [报告问题](https://github.com/88250/latke/issues/new/choose)\n\n## 📄 授权\n\nLatke 使用 [木兰宽松许可证, 第2版](http://license.coscl.org.cn/MulanPSL2) 开源协议。\n\n## 🙏 鸣谢\n\n* [Netty](https://github.com/netty/netty)：事件驱动的异步网络应用框架\n* [FreeMarker](https://github.com/apache/freemarker)：使用广泛的 Java 模版引擎\n* [Javassist](https://github.com/jboss-javassist/javassist)：Java 字节码处理工具库\n* [Apache Commons](http://commons.apache.org)：Java 相关工具库\n* [Apache Log4j](https://logging.apache.org/log4j/2.x)：Java 日志库\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffishpioffical%2Frhy-latke","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffishpioffical%2Frhy-latke","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffishpioffical%2Frhy-latke/lists"}