Skip to content

Commit 23b03cb

Browse files
committed
fix the apollo version logic by reading the server version instead of the apollo-core version
1 parent a73d032 commit 23b03cb

File tree

3 files changed

+33
-10
lines changed

3 files changed

+33
-10
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2022 Apollo Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
package com.ctrip.framework.apollo.common.constants;
18+
19+
/**
20+
* @author Jason Song(song_s@ctrip.com)
21+
*/
22+
public class ApolloServer {
23+
public final static String VERSION =
24+
"java-" + ApolloServer.class.getPackage().getImplementationVersion();
25+
}

apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/ApolloInfoController.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616
*/
1717
package com.ctrip.framework.apollo.common.controller;
1818

19-
import com.ctrip.framework.apollo.Apollo;
19+
import com.ctrip.framework.apollo.common.constants.ApolloServer;
2020
import com.ctrip.framework.foundation.Foundation;
21-
2221
import org.springframework.web.bind.annotation.RequestMapping;
2322
import org.springframework.web.bind.annotation.RestController;
2423

@@ -38,6 +37,6 @@ public String getServer() {
3837

3938
@RequestMapping("version")
4039
public String getVersion() {
41-
return Apollo.VERSION;
40+
return ApolloServer.VERSION;
4241
}
4342
}

apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/SystemInfoController.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@
1616
*/
1717
package com.ctrip.framework.apollo.portal.controller;
1818

19-
import com.ctrip.framework.apollo.Apollo;
20-
import com.ctrip.framework.apollo.portal.environment.PortalMetaDomainService;
19+
import com.ctrip.framework.apollo.common.constants.ApolloServer;
2120
import com.ctrip.framework.apollo.core.dto.ServiceDTO;
22-
import com.ctrip.framework.apollo.portal.environment.Env;
2321
import com.ctrip.framework.apollo.portal.component.PortalSettings;
2422
import com.ctrip.framework.apollo.portal.component.RestTemplateFactory;
2523
import com.ctrip.framework.apollo.portal.entity.vo.EnvironmentInfo;
2624
import com.ctrip.framework.apollo.portal.entity.vo.SystemInfo;
25+
import com.ctrip.framework.apollo.portal.environment.Env;
26+
import com.ctrip.framework.apollo.portal.environment.PortalMetaDomainService;
27+
import java.util.List;
28+
import javax.annotation.PostConstruct;
2729
import org.slf4j.Logger;
2830
import org.slf4j.LoggerFactory;
2931
import org.springframework.boot.actuate.health.Health;
@@ -34,9 +36,6 @@
3436
import org.springframework.web.bind.annotation.RestController;
3537
import org.springframework.web.client.RestTemplate;
3638

37-
import javax.annotation.PostConstruct;
38-
import java.util.List;
39-
4039
@RestController
4140
@RequestMapping("/system-info")
4241
public class SystemInfoController {
@@ -70,7 +69,7 @@ private void init() {
7069
public SystemInfo getSystemInfo() {
7170
SystemInfo systemInfo = new SystemInfo();
7271

73-
String version = Apollo.VERSION;
72+
String version = ApolloServer.VERSION;
7473
if (isValidVersion(version)) {
7574
systemInfo.setVersion(version);
7675
}

0 commit comments

Comments
 (0)