{"id":17686388,"url":"https://github.com/shihyuho/jackson-dynamic-filter-spring-boot-starter","last_synced_at":"2025-05-13T00:08:49.846Z","repository":{"id":57722749,"uuid":"142522885","full_name":"shihyuho/jackson-dynamic-filter-spring-boot-starter","owner":"shihyuho","description":"An easy way to determine filters dynamically with Jackson","archived":false,"fork":false,"pushed_at":"2018-07-31T03:02:51.000Z","size":50,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-13T00:08:41.144Z","etag":null,"topics":["filter","gson","jackson","property","spring-boot","spring-boot-starter","spring-mb"],"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/shihyuho.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":"2018-07-27T03:26:15.000Z","updated_at":"2024-04-29T11:05:22.000Z","dependencies_parsed_at":"2022-08-28T10:11:23.550Z","dependency_job_id":null,"html_url":"https://github.com/shihyuho/jackson-dynamic-filter-spring-boot-starter","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shihyuho%2Fjackson-dynamic-filter-spring-boot-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shihyuho%2Fjackson-dynamic-filter-spring-boot-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shihyuho%2Fjackson-dynamic-filter-spring-boot-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shihyuho%2Fjackson-dynamic-filter-spring-boot-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shihyuho","download_url":"https://codeload.github.com/shihyuho/jackson-dynamic-filter-spring-boot-starter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253843215,"owners_count":21972873,"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":["filter","gson","jackson","property","spring-boot","spring-boot-starter","spring-mb"],"created_at":"2024-10-24T10:44:45.628Z","updated_at":"2025-05-13T00:08:49.793Z","avatar_url":"https://github.com/shihyuho.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/shihyuho/jackson-dynamic-filter.svg?branch=master)](https://travis-ci.org/shihyuho/jackson-dynamic-filter-spring-boot-starter\n)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.shihyuho/jackson-dynamic-filter-spring-boot-starter/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.shihyuho/jackson-dynamic-filter-spring-boot-starter)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/shihyuho/jackson-dynamic-filter-spring-boot-starter/blob/master/LICENSE)\n\n# Jackson Dynamic Property Filter - Spring Boot Starter\n\nSpring Boot Starter for [jackson-dynamic-filter](https://github.com/shihyuho/jackson-dynamic-filter), which provides an easy way to determine filters dynamically with [jackson](https://github.com/FasterXML/jackson) WITHOUT writing annotations directly on java object, and it also well integration with Spring MVC/Spring Boot.\n\n## Prerequisites\n\n- Java 8 and above\n- [Maven](http://maven.apache.org/) 3.0 and above\n- Supported Spring IO Platform:\n    - [Athens-SR1](http://docs.spring.io/platform/docs/Athens-SR1/reference/htmlsingle/#appendix-dependency-versions)\n    - [Brussels-SR11](http://docs.spring.io/platform/docs/Brussels-SR11/reference/htmlsingle/#appendix-dependency-versions)\n    - [Cairo-SR2](http://docs.spring.io/platform/docs/Cairo-SR2/reference/htmlsingle/#appendix-dependency-versions)\n\n## Setup\n\nAll you need to do is to add dependency in your  Spring Boot Maven project:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.shihyuho\u003c/groupId\u003e\n    \u003cartifactId\u003ejackson-dynamic-filter-spring-boot-starter\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nOr in your Spring Boot Gradle project:\n\n````groovy\ncompile 'com.github.shihyuho:jackson-dynamic-filter-spring-boot-starter:1.0.1'\n````\n\nand it's done, have fun!\n\n## Using annotation\n\n- `@SerializeAllExcept` - Serializing all properties, except for ones explicitly listed to be filtered out.\n- `@FilterOutAllExcept` - Filtering out unknown properties and only serializes ones explicitly listed.\n\n```java\n@RestController\npublic class SomeController {\n\n  @SerializeAllExcept({\"someField\", \"anotherField\"})\n  @RequestMapping(value = \"/without/some-fields\", method = RequestMethod.GET)\n  public SomeObject withoutSomeFields() {\n    return someObject;\n  }\n\n  @FilterOutAllExcept({\"someField\", \"anotherField\"})\n  @RequestMapping(value = \"/only/some-fields\", method = RequestMethod.GET)\n  public SomeObject onlySomeFields() {\n    return someObject;\n  }\n}\n```\n\n## Custom annotation\n\nDefine a custom annotation:\n\n```java\n@Documented\n@Target({ElementType.METHOD})\n@Retention(RetentionPolicy.RUNTIME)\npublic @interface WithoutAuditingFields {\n}\n```\n\nthen register a resolver, extends `DynamicFilterResolver`, as Spring bean. Starter will auto find out all `DynamicFilterResolver` (including subclasses) in Spring context.\n\n```java\n@Component\npublic class WithoutAuditingFieldsResolver extends DynamicFilterResolver\u003cWithoutAuditingFields\u003e {\n\n  @Override\n  public PropertyFilter apply(WithoutAuditingFields annotation) {\n    return SimpleBeanPropertyFilter.serializeAllExcept(\n        \"id\", \"createdBy\", \"createdTime\", \"modifiedBy\", \"modifiedTime\");\n  }\n}\n```\n\n\u003e More detail about [SimpleBeanPropertyFilter](https://fasterxml.github.io/jackson-databind/javadoc/2.3.0/com/fasterxml/jackson/databind/ser/impl/SimpleBeanPropertyFilter.html)\n\nthen use it for you controller as follows:\n\n```java\n@RestController\npublic class SomeController {\n\n  @WithoutAuditingFields\n  @GetMapping(value = \"/some-path\")\n  public SomeObject getSomeObject() {\n    return someObject;\n  }\n}\n```\n\n## Application properties\n\nThe following properties can be specified inside your `application.properties` file, inside your `application.yml` file, or as command line switches. \n\n```properties\n# Application will halt if any exception occurred while initialing jackson-dynamic-filter; otherwise just write a error log.\njackson.dynamic.filter.fail-fast=false \n\n# Resolver classes (with a default constructor) that are not Spring beans, but still need to inject into jackson-dynamic-filter\njackson.dynamic.filter.resolver.class-names=this.is.my.Resolver,yet.another.Resolver\n```\n\n## Code Examples\n\nActual Spring Boot configurations and examples can be found in the [./_examples/](_examples) directory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshihyuho%2Fjackson-dynamic-filter-spring-boot-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshihyuho%2Fjackson-dynamic-filter-spring-boot-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshihyuho%2Fjackson-dynamic-filter-spring-boot-starter/lists"}