From b73d41929d4710823191d9e4f3739d081afe211f Mon Sep 17 00:00:00 2001 From: sidhantgoel Date: Tue, 17 Jan 2023 22:18:42 +0530 Subject: [PATCH] fix for caching library autoconfiguration (#19849) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit > Pull Request Template > > Use this template to quickly create a well written pull request. Delete all quotes before creating the pull request. ## Description Spring Boot 2.7 introduced a new META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports file for registering auto-configurations, while maintaining backwards compatibility with registration in spring.factories. With this release, support for registering auto-configurations in spring.factories has been removed in favor of the imports file. > Please include a summary of the changes and which issue has been fixed. Please also include relevant motivation > and context. List any dependencies that are required for this change > Links to Notion, Figma or any other documents that might be relevant to the PR > Add a TL;DR when description is extra long (helps content team) Fixes # (issue) > if no issue exists, please create an issue and ask the maintainers about this first Media > A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video ## Type of change > Please delete options that are not relevant. - Bug fix (non-breaking change which fixes an issue) - New feature (non-breaking change which adds functionality) - Breaking change (fix or feature that would cause existing functionality to not work as expected) - Chore (housekeeping or task changes that don't impact user perception) - This change requires a documentation update ## How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Provide instructions, so we can reproduce. > Please also list any relevant details for your test configuration. > Delete anything that is not important - Manual - Jest - Cypress ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test --- .../src/main/resources/META-INF/spring.factories | 2 -- ...framework.boot.autoconfigure.AutoConfiguration.imports | 1 + .../{caching => testcaching}/CacheApplication.java | 2 +- .../configuration/RedisTestContainerConfig.java | 2 +- .../{caching => testcaching}/model/ArgumentModel.java | 2 +- .../{caching => testcaching}/model/NestedModel.java | 2 +- .../{caching => testcaching}/model/ParentModel.java | 2 +- .../{caching => testcaching}/model/TestModel.java | 2 +- .../service/CacheTestService.java | 6 +++--- .../{caching => testcaching}/test/TestCachingMethods.java | 8 ++++---- 10 files changed, 14 insertions(+), 15 deletions(-) delete mode 100644 app/server/reactive-caching/src/main/resources/META-INF/spring.factories create mode 100644 app/server/reactive-caching/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports rename app/server/reactive-caching/src/test/java/com/appsmith/{caching => testcaching}/CacheApplication.java (89%) rename app/server/reactive-caching/src/test/java/com/appsmith/{caching => testcaching}/configuration/RedisTestContainerConfig.java (98%) rename app/server/reactive-caching/src/test/java/com/appsmith/{caching => testcaching}/model/ArgumentModel.java (79%) rename app/server/reactive-caching/src/test/java/com/appsmith/{caching => testcaching}/model/NestedModel.java (77%) rename app/server/reactive-caching/src/test/java/com/appsmith/{caching => testcaching}/model/ParentModel.java (77%) rename app/server/reactive-caching/src/test/java/com/appsmith/{caching => testcaching}/model/TestModel.java (91%) rename app/server/reactive-caching/src/test/java/com/appsmith/{caching => testcaching}/service/CacheTestService.java (96%) rename app/server/reactive-caching/src/test/java/com/appsmith/{caching => testcaching}/test/TestCachingMethods.java (95%) diff --git a/app/server/reactive-caching/src/main/resources/META-INF/spring.factories b/app/server/reactive-caching/src/main/resources/META-INF/spring.factories deleted file mode 100644 index c1b04ae09f..0000000000 --- a/app/server/reactive-caching/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,2 +0,0 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -com.appsmith.caching.CachingConfig \ No newline at end of file diff --git a/app/server/reactive-caching/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/app/server/reactive-caching/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000000..81f445488b --- /dev/null +++ b/app/server/reactive-caching/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.appsmith.caching.CachingConfig \ No newline at end of file diff --git a/app/server/reactive-caching/src/test/java/com/appsmith/caching/CacheApplication.java b/app/server/reactive-caching/src/test/java/com/appsmith/testcaching/CacheApplication.java similarity index 89% rename from app/server/reactive-caching/src/test/java/com/appsmith/caching/CacheApplication.java rename to app/server/reactive-caching/src/test/java/com/appsmith/testcaching/CacheApplication.java index ffeb04006d..e8c791bcd3 100644 --- a/app/server/reactive-caching/src/test/java/com/appsmith/caching/CacheApplication.java +++ b/app/server/reactive-caching/src/test/java/com/appsmith/testcaching/CacheApplication.java @@ -1,4 +1,4 @@ -package com.appsmith.caching; +package com.appsmith.testcaching; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/app/server/reactive-caching/src/test/java/com/appsmith/caching/configuration/RedisTestContainerConfig.java b/app/server/reactive-caching/src/test/java/com/appsmith/testcaching/configuration/RedisTestContainerConfig.java similarity index 98% rename from app/server/reactive-caching/src/test/java/com/appsmith/caching/configuration/RedisTestContainerConfig.java rename to app/server/reactive-caching/src/test/java/com/appsmith/testcaching/configuration/RedisTestContainerConfig.java index 4e0fc637cf..106a06b065 100644 --- a/app/server/reactive-caching/src/test/java/com/appsmith/caching/configuration/RedisTestContainerConfig.java +++ b/app/server/reactive-caching/src/test/java/com/appsmith/testcaching/configuration/RedisTestContainerConfig.java @@ -1,4 +1,4 @@ -package com.appsmith.caching.configuration; +package com.appsmith.testcaching.configuration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/app/server/reactive-caching/src/test/java/com/appsmith/caching/model/ArgumentModel.java b/app/server/reactive-caching/src/test/java/com/appsmith/testcaching/model/ArgumentModel.java similarity index 79% rename from app/server/reactive-caching/src/test/java/com/appsmith/caching/model/ArgumentModel.java rename to app/server/reactive-caching/src/test/java/com/appsmith/testcaching/model/ArgumentModel.java index 0d7255696f..80ef484ed6 100644 --- a/app/server/reactive-caching/src/test/java/com/appsmith/caching/model/ArgumentModel.java +++ b/app/server/reactive-caching/src/test/java/com/appsmith/testcaching/model/ArgumentModel.java @@ -1,4 +1,4 @@ -package com.appsmith.caching.model; +package com.appsmith.testcaching.model; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/app/server/reactive-caching/src/test/java/com/appsmith/caching/model/NestedModel.java b/app/server/reactive-caching/src/test/java/com/appsmith/testcaching/model/NestedModel.java similarity index 77% rename from app/server/reactive-caching/src/test/java/com/appsmith/caching/model/NestedModel.java rename to app/server/reactive-caching/src/test/java/com/appsmith/testcaching/model/NestedModel.java index 3795e2bd87..092dd73eb7 100644 --- a/app/server/reactive-caching/src/test/java/com/appsmith/caching/model/NestedModel.java +++ b/app/server/reactive-caching/src/test/java/com/appsmith/testcaching/model/NestedModel.java @@ -1,4 +1,4 @@ -package com.appsmith.caching.model; +package com.appsmith.testcaching.model; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/app/server/reactive-caching/src/test/java/com/appsmith/caching/model/ParentModel.java b/app/server/reactive-caching/src/test/java/com/appsmith/testcaching/model/ParentModel.java similarity index 77% rename from app/server/reactive-caching/src/test/java/com/appsmith/caching/model/ParentModel.java rename to app/server/reactive-caching/src/test/java/com/appsmith/testcaching/model/ParentModel.java index 946cb1f2b2..95130a68f3 100644 --- a/app/server/reactive-caching/src/test/java/com/appsmith/caching/model/ParentModel.java +++ b/app/server/reactive-caching/src/test/java/com/appsmith/testcaching/model/ParentModel.java @@ -1,4 +1,4 @@ -package com.appsmith.caching.model; +package com.appsmith.testcaching.model; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/app/server/reactive-caching/src/test/java/com/appsmith/caching/model/TestModel.java b/app/server/reactive-caching/src/test/java/com/appsmith/testcaching/model/TestModel.java similarity index 91% rename from app/server/reactive-caching/src/test/java/com/appsmith/caching/model/TestModel.java rename to app/server/reactive-caching/src/test/java/com/appsmith/testcaching/model/TestModel.java index d6b4a6da23..e50c5b29c2 100644 --- a/app/server/reactive-caching/src/test/java/com/appsmith/caching/model/TestModel.java +++ b/app/server/reactive-caching/src/test/java/com/appsmith/testcaching/model/TestModel.java @@ -1,4 +1,4 @@ -package com.appsmith.caching.model; +package com.appsmith.testcaching.model; import java.time.Instant; diff --git a/app/server/reactive-caching/src/test/java/com/appsmith/caching/service/CacheTestService.java b/app/server/reactive-caching/src/test/java/com/appsmith/testcaching/service/CacheTestService.java similarity index 96% rename from app/server/reactive-caching/src/test/java/com/appsmith/caching/service/CacheTestService.java rename to app/server/reactive-caching/src/test/java/com/appsmith/testcaching/service/CacheTestService.java index a5a98995db..ed8b2288f6 100644 --- a/app/server/reactive-caching/src/test/java/com/appsmith/caching/service/CacheTestService.java +++ b/app/server/reactive-caching/src/test/java/com/appsmith/testcaching/service/CacheTestService.java @@ -1,4 +1,4 @@ -package com.appsmith.caching.service; +package com.appsmith.testcaching.service; import java.time.Duration; import java.util.ArrayList; @@ -7,9 +7,9 @@ import java.util.List; import org.springframework.stereotype.Service; import com.appsmith.caching.annotations.CacheEvict; +import com.appsmith.testcaching.model.ArgumentModel; +import com.appsmith.testcaching.model.TestModel; import com.appsmith.caching.annotations.Cache; -import com.appsmith.caching.model.ArgumentModel; -import com.appsmith.caching.model.TestModel; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; diff --git a/app/server/reactive-caching/src/test/java/com/appsmith/caching/test/TestCachingMethods.java b/app/server/reactive-caching/src/test/java/com/appsmith/testcaching/test/TestCachingMethods.java similarity index 95% rename from app/server/reactive-caching/src/test/java/com/appsmith/caching/test/TestCachingMethods.java rename to app/server/reactive-caching/src/test/java/com/appsmith/testcaching/test/TestCachingMethods.java index 9684691910..85f787fd51 100644 --- a/app/server/reactive-caching/src/test/java/com/appsmith/caching/test/TestCachingMethods.java +++ b/app/server/reactive-caching/src/test/java/com/appsmith/testcaching/test/TestCachingMethods.java @@ -1,4 +1,4 @@ -package com.appsmith.caching.test; +package com.appsmith.testcaching.test; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -13,9 +13,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import com.appsmith.caching.components.CacheManager; -import com.appsmith.caching.model.ArgumentModel; -import com.appsmith.caching.model.TestModel; -import com.appsmith.caching.service.CacheTestService; +import com.appsmith.testcaching.model.ArgumentModel; +import com.appsmith.testcaching.model.TestModel; +import com.appsmith.testcaching.service.CacheTestService; import lombok.extern.slf4j.Slf4j;