From 9b7336dce44be1cd239d6aaff7b0169263ac8ec5 Mon Sep 17 00:00:00 2001 From: Emily Wang Date: Fri, 6 Jan 2023 09:45:40 -0500 Subject: [PATCH] fix(spring): add AutoConfigureAfter annotation (#1208) This adds AutoConfigureAfter(GcpContextAutoConfiguration.class) annotation to enforce configuration order. It also makes two related changes to enable this annotation: * Switches dependency from spring-cloud-gcp-core to spring-cloud-gcp-autoconfigure, and bumps version to latest * Fixes ImportWriter to account for types introduced by annotation parameters --- BUILD.bazel | 1 + WORKSPACE | 2 +- pom.xml | 4 +- .../engine/writer/ImportWriterVisitor.java | 3 ++ .../SpringAutoConfigClassComposer.java | 16 ++++++++ .../writer/ImportWriterVisitorTest.java | 38 +++++++++++++++++++ .../EchoSpringAutoConfigurationFull.golden | 3 ++ .../EchoSpringAutoConfigurationGrpc.golden | 3 ++ ...EchoSpringAutoConfigurationGrpcRest.golden | 3 ++ 9 files changed, 70 insertions(+), 3 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 362d83d2a8..3ebbe83dc4 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -53,6 +53,7 @@ SPRING_DEPS = [ "@maven//:org_springframework_boot_spring_boot", "@maven//:org_springframework_spring_context", "@maven//:org_springframework_spring_beans", + "@maven//:com_google_cloud_spring_cloud_gcp_autoconfigure", "@maven//:com_google_cloud_spring_cloud_gcp_core", "@maven//:commons_logging_commons_logging", ] diff --git a/WORKSPACE b/WORKSPACE index 3eedf8aaa9..0168823bba 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -82,7 +82,7 @@ load("@rules_jvm_external//:defs.bzl", "maven_install") SPRING_MAVEN_ARTIFACTS = [ "org.springframework.boot:spring-boot-starter:2.7.4", - "com.google.cloud:spring-cloud-gcp-core:3.3.0", + "com.google.cloud:spring-cloud-gcp-autoconfigure:3.4.1", ] maven_install( diff --git a/pom.xml b/pom.xml index 063770f211..64f732d00c 100644 --- a/pom.xml +++ b/pom.xml @@ -332,8 +332,8 @@ com.google.cloud - spring-cloud-gcp-core - 3.3.0 + spring-cloud-gcp-autoconfigure + 3.4.1