diff --git a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/constants/ApolloServer.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/constants/ApolloServer.java new file mode 100644 index 00000000000..323362dbf6e --- /dev/null +++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/constants/ApolloServer.java @@ -0,0 +1,25 @@ +/* + * Copyright 2022 Apollo Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package com.ctrip.framework.apollo.common.constants; + +/** + * @author Jason Song(song_s@ctrip.com) + */ +public class ApolloServer { + public final static String VERSION = + "java-" + ApolloServer.class.getPackage().getImplementationVersion(); +} diff --git a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/ApolloInfoController.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/ApolloInfoController.java index 73b478968dd..43e19c51dc9 100644 --- a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/ApolloInfoController.java +++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/ApolloInfoController.java @@ -16,9 +16,8 @@ */ package com.ctrip.framework.apollo.common.controller; -import com.ctrip.framework.apollo.Apollo; +import com.ctrip.framework.apollo.common.constants.ApolloServer; import com.ctrip.framework.foundation.Foundation; - import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -38,6 +37,6 @@ public String getServer() { @RequestMapping("version") public String getVersion() { - return Apollo.VERSION; + return ApolloServer.VERSION; } } diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/SystemInfoController.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/SystemInfoController.java index a10c7a3dcac..dc30c21c561 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/SystemInfoController.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/SystemInfoController.java @@ -16,14 +16,16 @@ */ package com.ctrip.framework.apollo.portal.controller; -import com.ctrip.framework.apollo.Apollo; -import com.ctrip.framework.apollo.portal.environment.PortalMetaDomainService; +import com.ctrip.framework.apollo.common.constants.ApolloServer; import com.ctrip.framework.apollo.core.dto.ServiceDTO; -import com.ctrip.framework.apollo.portal.environment.Env; import com.ctrip.framework.apollo.portal.component.PortalSettings; import com.ctrip.framework.apollo.portal.component.RestTemplateFactory; import com.ctrip.framework.apollo.portal.entity.vo.EnvironmentInfo; import com.ctrip.framework.apollo.portal.entity.vo.SystemInfo; +import com.ctrip.framework.apollo.portal.environment.Env; +import com.ctrip.framework.apollo.portal.environment.PortalMetaDomainService; +import java.util.List; +import javax.annotation.PostConstruct; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.actuate.health.Health; @@ -34,9 +36,6 @@ import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; -import javax.annotation.PostConstruct; -import java.util.List; - @RestController @RequestMapping("/system-info") public class SystemInfoController { @@ -70,7 +69,7 @@ private void init() { public SystemInfo getSystemInfo() { SystemInfo systemInfo = new SystemInfo(); - String version = Apollo.VERSION; + String version = ApolloServer.VERSION; if (isValidVersion(version)) { systemInfo.setVersion(version); }