diff --git a/CHANGELOG.md b/CHANGELOG.md index 5037529d0..4e5cfd7ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,4 +19,5 @@ - [feat:add Tencent Cloud TSF support.](https://github.com/Tencent/spring-cloud-tencent/pull/1391) - [feat:support consul config.](https://github.com/Tencent/spring-cloud-tencent/pull/1394) - [feat:add trace report support.](https://github.com/Tencent/spring-cloud-tencent/pull/1396) -- [feat:support consul service update task.](https://github.com/Tencent/spring-cloud-tencent/pull/1397) \ No newline at end of file +- [feat:support consul service update task.](https://github.com/Tencent/spring-cloud-tencent/pull/1397) +- [fix:fix app starting failed when user using custom OpenAPI bean.](https://github.com/Tencent/spring-cloud-tencent/pull/1398) \ No newline at end of file diff --git a/pom.xml b/pom.xml index 64095d311..2973cc9eb 100644 --- a/pom.xml +++ b/pom.xml @@ -89,7 +89,7 @@ - 1.14.0-2020.0.6-SNAPSHOT + 2.0.0.0-2020.0.6-SNAPSHOT 5.3.25 diff --git a/spring-cloud-starter-tencent-polaris-contract/src/main/java/com/tencent/cloud/polaris/contract/config/PolarisContractProperties.java b/spring-cloud-starter-tencent-polaris-contract/src/main/java/com/tencent/cloud/polaris/contract/config/PolarisContractProperties.java index 0fdc0a1d4..3f698288d 100644 --- a/spring-cloud-starter-tencent-polaris-contract/src/main/java/com/tencent/cloud/polaris/contract/config/PolarisContractProperties.java +++ b/spring-cloud-starter-tencent-polaris-contract/src/main/java/com/tencent/cloud/polaris/contract/config/PolarisContractProperties.java @@ -46,7 +46,7 @@ public class PolarisContractProperties implements ContractProperties { /** * Group to create swagger docket. */ - private String group = "default"; + private String group = "polaris"; /** * Base paths to be scanned. Split by ",". */ diff --git a/spring-cloud-starter-tencent-polaris-contract/src/main/java/com/tencent/cloud/polaris/contract/config/PolarisSwaggerAutoConfiguration.java b/spring-cloud-starter-tencent-polaris-contract/src/main/java/com/tencent/cloud/polaris/contract/config/PolarisSwaggerAutoConfiguration.java index 6f2f76660..ca8c36bea 100644 --- a/spring-cloud-starter-tencent-polaris-contract/src/main/java/com/tencent/cloud/polaris/contract/config/PolarisSwaggerAutoConfiguration.java +++ b/spring-cloud-starter-tencent-polaris-contract/src/main/java/com/tencent/cloud/polaris/contract/config/PolarisSwaggerAutoConfiguration.java @@ -83,6 +83,7 @@ public GroupedOpenApi polarisGroupedOpenApi(PolarisContractProperties polarisCon } @Bean + @ConditionalOnMissingBean public OpenAPI polarisOpenAPI() { return new OpenAPI() .info(new Info() diff --git a/spring-cloud-starter-tencent-polaris-contract/src/main/java/com/tencent/cloud/polaris/contract/tsf/TsfContractProperties.java b/spring-cloud-starter-tencent-polaris-contract/src/main/java/com/tencent/cloud/polaris/contract/tsf/TsfContractProperties.java index 74e48d801..64cd71051 100644 --- a/spring-cloud-starter-tencent-polaris-contract/src/main/java/com/tencent/cloud/polaris/contract/tsf/TsfContractProperties.java +++ b/spring-cloud-starter-tencent-polaris-contract/src/main/java/com/tencent/cloud/polaris/contract/tsf/TsfContractProperties.java @@ -39,7 +39,7 @@ public class TsfContractProperties implements ExtendedContractProperties { @Value("${tsf.swagger.enabled:true}") private boolean enabled; - @Value("${tsf.swagger.group:default}") + @Value("${tsf.swagger.group:polaris}") private String groupName; @Value("${tsf.swagger.basePath:/**}") diff --git a/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/RouterConfigModifier.java b/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/RouterConfigModifier.java index 455578050..67376a187 100644 --- a/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/RouterConfigModifier.java +++ b/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/RouterConfigModifier.java @@ -22,10 +22,10 @@ import com.tencent.cloud.polaris.context.PolarisConfigModifier; import com.tencent.cloud.polaris.router.config.properties.PolarisNearByRouterProperties; import com.tencent.polaris.api.config.consumer.ServiceRouterConfig; -import com.tencent.polaris.api.plugin.route.LocationLevel; import com.tencent.polaris.factory.config.ConfigurationImpl; import com.tencent.polaris.plugins.router.healthy.RecoverRouterConfig; import com.tencent.polaris.plugins.router.nearby.NearbyRouterConfig; +import com.tencent.polaris.specification.api.v1.traffic.manage.RoutingProto; import org.apache.commons.lang.StringUtils; /** @@ -53,7 +53,8 @@ public void modify(ConfigurationImpl configuration) { .setPluginConfig(ServiceRouterConfig.DEFAULT_ROUTER_RECOVER, recoverRouterConfig); if (StringUtils.isNotBlank(polarisNearByRouterProperties.getMatchLevel())) { - LocationLevel locationLevel = LocationLevel.valueOf(polarisNearByRouterProperties.getMatchLevel()); + RoutingProto.NearbyRoutingConfig.LocationLevel locationLevel = + RoutingProto.NearbyRoutingConfig.LocationLevel.valueOf(StringUtils.upperCase(polarisNearByRouterProperties.getMatchLevel())); NearbyRouterConfig nearbyRouterConfig = configuration.getConsumer().getServiceRouter().getPluginConfig( ServiceRouterConfig.DEFAULT_ROUTER_NEARBY, NearbyRouterConfig.class); nearbyRouterConfig.setMatchLevel(locationLevel); diff --git a/spring-cloud-tencent-dependencies/pom.xml b/spring-cloud-tencent-dependencies/pom.xml index e761f1220..10505dbe8 100644 --- a/spring-cloud-tencent-dependencies/pom.xml +++ b/spring-cloud-tencent-dependencies/pom.xml @@ -71,10 +71,10 @@ - 1.14.0-2020.0.6-SNAPSHOT + 2.0.0.0-2020.0.6-SNAPSHOT - 1.15.8-SNAPSHOT + 2.0.0.0-SNAPSHOT 32.0.1-jre diff --git a/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/PostInitPolarisSDKContext.java b/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/PostInitPolarisSDKContext.java index bf41c50bd..132d9e618 100644 --- a/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/PostInitPolarisSDKContext.java +++ b/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/PostInitPolarisSDKContext.java @@ -20,8 +20,8 @@ import com.tencent.cloud.common.metadata.StaticMetadataManager; import com.tencent.polaris.api.plugin.common.ValueContext; -import com.tencent.polaris.api.plugin.route.LocationLevel; import com.tencent.polaris.client.api.SDKContext; +import com.tencent.polaris.specification.api.v1.traffic.manage.RoutingProto; import org.apache.commons.lang.StringUtils; /** @@ -39,13 +39,13 @@ public PostInitPolarisSDKContext(SDKContext sdkContext, StaticMetadataManager st ValueContext valueContext = sdkContext.getValueContext(); if (StringUtils.isNotBlank(region)) { - valueContext.setValue(LocationLevel.region.name(), region); + valueContext.setValue(RoutingProto.NearbyRoutingConfig.LocationLevel.REGION.name(), region); } if (StringUtils.isNotBlank(zone)) { - valueContext.setValue(LocationLevel.zone.name(), zone); + valueContext.setValue(RoutingProto.NearbyRoutingConfig.LocationLevel.ZONE.name(), zone); } if (StringUtils.isNotBlank(campus)) { - valueContext.setValue(LocationLevel.campus.name(), campus); + valueContext.setValue(RoutingProto.NearbyRoutingConfig.LocationLevel.CAMPUS.name(), campus); } } } diff --git a/spring-cloud-tencent-polaris-context/src/test/java/com/tencent/cloud/polaris/context/PostInitPolarisSDKContextTest.java b/spring-cloud-tencent-polaris-context/src/test/java/com/tencent/cloud/polaris/context/PostInitPolarisSDKContextTest.java index a5567c764..c6d06f8a5 100644 --- a/spring-cloud-tencent-polaris-context/src/test/java/com/tencent/cloud/polaris/context/PostInitPolarisSDKContextTest.java +++ b/spring-cloud-tencent-polaris-context/src/test/java/com/tencent/cloud/polaris/context/PostInitPolarisSDKContextTest.java @@ -19,8 +19,8 @@ import com.tencent.cloud.common.metadata.StaticMetadataManager; import com.tencent.polaris.api.plugin.common.ValueContext; -import com.tencent.polaris.api.plugin.route.LocationLevel; import com.tencent.polaris.client.api.SDKContext; +import com.tencent.polaris.specification.api.v1.traffic.manage.RoutingProto; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -55,9 +55,9 @@ public void testConstructor() { when(staticMetadataManager.getCampus()).thenReturn(CAMPUS); new PostInitPolarisSDKContext(sdkContext, staticMetadataManager); - String regionName = valueContext.getValue(LocationLevel.region.name()); - String zoneName = valueContext.getValue(LocationLevel.zone.name()); - String campusName = valueContext.getValue(LocationLevel.campus.name()); + String regionName = valueContext.getValue(RoutingProto.NearbyRoutingConfig.LocationLevel.REGION.name()); + String zoneName = valueContext.getValue(RoutingProto.NearbyRoutingConfig.LocationLevel.ZONE.name()); + String campusName = valueContext.getValue(RoutingProto.NearbyRoutingConfig.LocationLevel.CAMPUS.name()); Assertions.assertThat(regionName).isEqualTo(REGION); Assertions.assertThat(zoneName).isEqualTo(ZONE);