{"id":20496333,"url":"https://github.com/allurx/blur-spring-boot","last_synced_at":"2025-08-21T11:32:18.908Z","repository":{"id":41272314,"uuid":"225888843","full_name":"allurx/blur-spring-boot","owner":"allurx","description":"Integration of the blur library with Spring Boot","archived":false,"fork":false,"pushed_at":"2024-11-08T04:58:44.000Z","size":109,"stargazers_count":40,"open_issues_count":0,"forks_count":12,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-01T03:02:43.274Z","etag":null,"topics":["aop","desensitization","spring-boot"],"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/allurx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2019-12-04T14:41:12.000Z","updated_at":"2024-11-14T09:16:22.000Z","dependencies_parsed_at":"2024-11-14T11:10:01.253Z","dependency_job_id":"62ed10da-92fe-4d83-b815-3def3bba6216","html_url":"https://github.com/allurx/blur-spring-boot","commit_stats":null,"previous_names":["allurx/blur-spring-boot","allurx/desensitization-spring-boot"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/allurx/blur-spring-boot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allurx%2Fblur-spring-boot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allurx%2Fblur-spring-boot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allurx%2Fblur-spring-boot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allurx%2Fblur-spring-boot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/allurx","download_url":"https://codeload.github.com/allurx/blur-spring-boot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allurx%2Fblur-spring-boot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271470214,"owners_count":24765347,"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-08-21T02:00:08.990Z","response_time":74,"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":["aop","desensitization","spring-boot"],"created_at":"2024-11-15T18:06:36.753Z","updated_at":"2025-08-21T11:32:18.602Z","avatar_url":"https://github.com/allurx.png","language":"Java","readme":"# blur-spring-boot\n\nThis project integrates the [blur](https://github.com/allurx/blur) library into Spring Boot to enable automatic data blurring. Using Spring AOP, this library globally intercepts targeted methods to apply blurring (data masking) by default on all methods within the package of the Spring Boot application's main class and its sub-packages.\n\nTo further customize the blurring, you can specify a custom pointcut expression using `blur`-prefixed parameters in the Spring configuration file. Alternatively, you can define an `Advisor` named `blurAdvisor` in the Spring context to gain more granular control over the blurring process.\n\n# Usage\n\n## Spring Boot Version\n\n3.3.5\n\n## Maven Dependency\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.allurx\u003c/groupId\u003e\n    \u003cartifactId\u003eblur-spring-boot-starter\u003c/artifactId\u003e\n    \u003cversion\u003e${latest version}\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Notes\nBy default, this library enables blurring for methods returning Spring’s `ResponseEntity` type only. If your application uses a custom response entity, such as:\n```java\npublic class CustomizedResponse\u003cT\u003e {\n\n    public T data;\n\n    public String code;\n\n    public String message;\n\n    public CustomizedResponse() {}\n\n    public CustomizedResponse(T data, String code, String message) {\n        this.data = data;\n        this.code = code;\n        this.message = message;\n    }\n\n}\n```\nthen you’ll need to configure a type parser to handle custom types for blurring.\n```java\n@Configuration\npublic class BlurConfig {\n\n    /**\n     * Registers the {@code CustomizedResponseTypeParser} as a bean in the Spring context.\n     *\n     * @return {@link CustomizedResponseTypeParser}\n     */\n    @Bean\n    public TypeParser\u003cCustomizedResponse\u003cObject\u003e, AnnotatedParameterizedType\u003e typeParser() {\n        return new CustomizedResponseTypeParser();\n    }\n\n    /**\n     * Custom type parser to handle {@code CustomizedResponse} type data.\n     */\n    public static class CustomizedResponseTypeParser\n            implements TypeParser\u003cCustomizedResponse\u003cObject\u003e, AnnotatedParameterizedType\u003e, AopInfrastructureBean {\n\n        private final int order = AnnotationParser.randomOrder();\n\n        @Override\n        public CustomizedResponse\u003cObject\u003e parse(CustomizedResponse\u003cObject\u003e response, AnnotatedParameterizedType type) {\n            AnnotatedType typeArgument = type.getAnnotatedActualTypeArguments()[0];\n            Object blurredData = AnnotationParser.parse(response.getData(), typeArgument);\n            return new CustomizedResponse\u003c\u003e(blurredData, response.getMessage(), response.getCode());\n        }\n\n        @Override\n        public boolean support(Object value, AnnotatedType annotatedType) {\n            return value instanceof CustomizedResponse \u0026\u0026 annotatedType instanceof AnnotatedParameterizedType;\n        }\n\n        @Override\n        public int order() {\n            return order;\n        }\n    }\n}\n```\nThis configuration blurs `CustomizedResponse` type objects, \ntypically applying blurring only to the actual data (`data`) within the response body. \nAfter adding this type parser to the Spring context, \nyou need only annotate the generic parameter of the return object in the method with the blurring annotation to enable automatic blurring for `CustomizedResponse` type data.\n\n## Examples\n\n### Blurring `ResponseEntity` Type Data\n1. [Blurred method example](blur-spring-boot-samples/blur-spring-boot-sample-web/src/main/java/io/allurx/blur/spring/boot/sample/web/controller/ResponseEntityBlurController.java)\n2. [Related test cases](blur-spring-boot-samples/blur-spring-boot-sample-web/src/test/java/io/allurx/blur/spring/boot/sample/web/test/ResponseEntityBlurTest.java)\n\n### Blurring `CustomizedResponse` Type Data\n1. [Blurred method example](blur-spring-boot-samples/blur-spring-boot-sample-web/src/main/java/io/allurx/blur/spring/boot/sample/web/controller/CustomizedResponseBlurController.java)\n2. [Related test cases](blur-spring-boot-samples/blur-spring-boot-sample-web/src/test/java/io/allurx/blur/spring/boot/sample/web/test/CustomizedResponseBlurTest.java)\n\n# License\n[Apache License 2.0](LICENSE.txt)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallurx%2Fblur-spring-boot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fallurx%2Fblur-spring-boot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallurx%2Fblur-spring-boot/lists"}