{"id":48680774,"url":"https://github.com/filelize/filelize-java","last_synced_at":"2026-05-18T12:05:40.210Z","repository":{"id":227325588,"uuid":"770589197","full_name":"filelize/filelize-java","owner":"filelize","description":"Filelize is a lightweight database designed to simplify writing and reading data into human-readable files, requiring just one line of code","archived":false,"fork":false,"pushed_at":"2026-04-01T08:53:49.000Z","size":248,"stargazers_count":58,"open_issues_count":4,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-04-01T10:30:40.691Z","etag":null,"topics":["database","filelize","java","kotlin"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/filelize.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":null,"patreon":"Arcone","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"custom":null}},"created_at":"2024-03-11T20:08:23.000Z","updated_at":"2026-04-01T08:53:47.000Z","dependencies_parsed_at":"2024-04-09T07:28:50.608Z","dependency_job_id":"f56e8975-220f-4d5b-a557-baf1210c6e59","html_url":"https://github.com/filelize/filelize-java","commit_stats":null,"previous_names":["filelize/filelize-java"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/filelize/filelize-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filelize%2Ffilelize-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filelize%2Ffilelize-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filelize%2Ffilelize-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filelize%2Ffilelize-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/filelize","download_url":"https://codeload.github.com/filelize/filelize-java/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filelize%2Ffilelize-java/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32310804,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T19:15:34.056Z","status":"ssl_error","status_checked_at":"2026-04-26T19:15:15.467Z","response_time":129,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["database","filelize","java","kotlin"],"created_at":"2026-04-11T01:00:36.063Z","updated_at":"2026-04-26T20:00:45.817Z","avatar_url":"https://github.com/filelize.png","language":"Java","funding_links":["https://patreon.com/Arcone"],"categories":["数据库"],"sub_categories":["Spring Cloud框架"],"readme":"# Filelize for java, android and kotlin\n![Filelize build status](https://github.com/filelize/filelize-java/actions/workflows/maven.yml/badge.svg) ![Filelize release status](https://github.com/filelize/filelize-java/actions/workflows/maven-publish.yml/badge.svg)\n\n\u003cimg align=\"right\" src=\"/filelize.jpg\" alt=\"Filelize\" width=\"160\" height=\"160\"\u003e \n\nFilelize is a lightweight database that simplifies writing and reading data into human-readable files, requiring just one line of code. As highlighted in [Navigate Early Development | Simplify Data Storage](https://medium.com/@jtbsorensen/navigate-early-development-simplify-data-storage-c76013878cb4), Filelize focuses on reducing development overhead and optimizing data storage practices.\n\nOne of the biggest advantages is in the annotations and methods provided, eliminating the need for repetitive boilerplate code. Additionally, it offers flexibility with options for both single and multiple file storage, giving an easy way to work with very large collections distributed among multiple files. \nFilelize is most commonly used to save files as json for [Test Data Setup](https://github.com/filelize/filelize-java?tab=readme-ov-file#filelize-for-test-data-setup) or when a full-fledged database isn't necessary.\n\n### Usage\n\nTo integrate [Filelizer](https://mvnrepository.com/artifact/io.github.filelize/filelize-java) into your project, add the following dependency to your pom.xml \n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eio.github.filelize\u003c/groupId\u003e\n  \u003cartifactId\u003efilelize-java\u003c/artifactId\u003e\n  \u003cversion\u003e0.9.6\u003c/version\u003e\n\u003c/dependency\u003e\n```\nFor Gradle, you can use:\n```groovy\nimplementation 'io.github.filelize:filelize-java:0.9.5'\n```\n\nRef: [Publish your artifact to the Maven Central Repository using GitHub Actions](https://medium.com/@jtbsorensen/publish-your-artifact-to-the-maven-central-repository-using-github-actions-15d3b5d9ce88)\n\n## Getting started\n\nInitialize a `Filelizer` with your preferred location of your files. (For subdirectories you can add them directly on your domain object)\n\n```java\nFilelizer filelizer = new Filelizer(\"src/test/resources/\");\n```\n#### Save an object\n```java\nString id = filelizer.save(something);\n```\n#### SaveAll objects in one or multiple file(s):\n```java\nList\u003cString\u003e ids = filelizer.saveAll(somethings);\n```\n#### Find a object\n```java\nSomething something = filelizer.find(\"id1\", Something.class);\n```\n#### FindAll objects:\n```java\nList\u003cSomething\u003e somethings = filelizer.findAll(Something.class);\n```\n\n### Saving to a single file\nTo save an object to a single file, annotate your model class with `@Filelize` and set the `type` parameter to `FilelizeType.SINGLE_FILE`. Additionally, mark the identifying attribute with `@Id`.\n\n```java\nimport io.github.filelize.Filelize;\nimport io.github.filelize.Id;\n\n@Filelize(name = \"something_single\", type = FilelizeType.SINGLE_FILE, directory = \"something_single\")\npublic class Something {\n    @Id\n    private String id;\n    private String name;\n    ...\n}\n```\n\n### Saving to multiple files\nFor saving objects to multiple files, follow the same steps as for single-file saving, but set the type parameter to `FilelizeType.MULTIPLE_FILES`.\n\n```java\nimport io.github.filelize.Filelize;\nimport io.github.filelize.Id;\n\n@Filelize(name = \"my_something\", type = FilelizeType.MULTIPLE_FILES, directory = \"something_multiple/mydirectory\")\npublic class Something {\n    @Id\n    private String id;\n    private String name;\n    ...\n}\n```\n\n## Filelize in Spring Boot\nSpring Boot applications typically leverage annotations and configuration classes for managing beans and functionalities.\nHere's how you can use Filelizer in a Spring Boot application:\n\n```java\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport org.springframework.stereotype.Service;\nimport io.github.filelize.FilelizeType;\nimport io.github.filelize.Filelizer;\n\n@Service\npublic class FilelizerService {\n\n    private final ObjectMapper objectMapper;\n    private final Filelizer filelizer;\n\n    public FilelizerService(ObjectMapper objectMapper) {\n        this.objectMapper = objectMapper;\n        this.filelizer = new Filelizer(\"src/main/resources/\", objectMapper, FilelizeType.OBJECT_FILE);\n    }\n    \n    public void updateName(String id, String name){\n        var something = filelizer.find(id, Something.class);\n        something.setName(name);\n        filelizer.save(something);\n    }\n}\n```\n\n## Filelize for Test Data Setup\n\nSo you are working on setting up test data scenario for your unit test. This manual process is typically involving alot of boilerplate code. This is especially true when working on complex classes that contain many fields and collections.\nWhat we usually need is the presence of an object, where only a few values are important to be able to make a meaningful test.\nHere are some steps you could take to setup your test data:\n\n1. Create a Filelizer service that saves your objects or collections to a test data folder\n```java\nFilelizer filelizer = new Filelizer(\"src/test/resources/testdata\");\n```\n2. Run the application with the scenarios that you wanna test. Make sure to save the result for each scenario, e.g. `filelizer.save(\"somethingTest1\", something);`\n3. Now you should have some test data files in your testdata folder like: `.../testdata/somethingTest1.json` and `.../testdata/somethingTest2.json`\n4. Create a test and load your test data\n```java\n@Test\npublic void testSomething() {\n    var something = filelizer.find(\"somethingTest2\", Something.class);\n    assertEquals(\"somethingTest2\", something.getId());\n}\n```\n\n## Contribute\nContributions are welcomed! Feel free to create a pull request to contribute.\n\n[![Star History Chart](https://api.star-history.com/svg?repos=filelize/filelize-java\u0026type=Date)](https://star-history.com/#filelize/filelize-java\u0026Date)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffilelize%2Ffilelize-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffilelize%2Ffilelize-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffilelize%2Ffilelize-java/lists"}