diff --git a/.gitignore b/.gitignore index 12448ce..228a168 100644 --- a/.gitignore +++ b/.gitignore @@ -35,5 +35,5 @@ gradle.properties *.crt *.key - +application-test.properties diff --git a/Changelog.md b/Changelog.md index d0da3f2..7419c68 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,22 @@ +### v1.4.0 + + (2020-08-06) + + +**Add** +- 增加返回 Version 版本接口 + +**兼容性** + +- 支持FISCO-BCOS v2.0.0-rc1 版本 +- 支持FISCO-BCOS v2.0.0-rc2 版本 +- 支持FISCO-BCOS v2.0.0-rc3 版本 +- 支持FISCO-BCOS v2.0.0 及以上版本 +- WeBASE-Sign v1.4.0+ + +详细了解,请阅读[**技术文档**](https://webasedoc.readthedocs.io/zh_CN/latest/)。 + + ### v1.3.2 (2020-06-17) diff --git a/build.gradle b/build.gradle index d994870..6a45eaa 100644 --- a/build.gradle +++ b/build.gradle @@ -103,6 +103,8 @@ dependencies { compile "commons-io:commons-io:2.4" compile "io.shardingsphere:sharding-jdbc-spring-boot-starter:3.1.0" compile 'org.projectlombok:lombok:1.18.2' + compile 'com.alibaba:druid:1.1.23' + compile ('com.google.guava:guava:20.0'){force = true} annotationProcessor 'org.projectlombok:lombok:1.18.2' } diff --git a/src/main/java/com/webank/webase/transaction/base/VersionProperties.java b/src/main/java/com/webank/webase/transaction/base/VersionProperties.java new file mode 100644 index 0000000..3a86070 --- /dev/null +++ b/src/main/java/com/webank/webase/transaction/base/VersionProperties.java @@ -0,0 +1,30 @@ +/** + * Copyright 2014-2020 the original author or 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.webank.webase.transaction.base; + +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +/** + * load 'version' in .yml + */ +@Data +@Component +public class VersionProperties { + + @Value("${version}") + private String version; +} diff --git a/src/main/java/com/webank/webase/transaction/version/VersionController.java b/src/main/java/com/webank/webase/transaction/version/VersionController.java new file mode 100644 index 0000000..be907ea --- /dev/null +++ b/src/main/java/com/webank/webase/transaction/version/VersionController.java @@ -0,0 +1,45 @@ +/** + * Copyright 2014-2020 the original author or 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.webank.webase.transaction.version; + +import com.webank.webase.transaction.base.VersionProperties; +import io.swagger.annotations.Api; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * return version of local server + */ +@Api(value = "/version", tags = "server version") +@Slf4j +@RestController +@RequestMapping("version") +public class VersionController { + + @Autowired + private VersionProperties versionProperties; + + /** + * return version + * @return + */ + @GetMapping() + public String getServerVersion() { + return versionProperties.getVersion(); + } +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index c64b7d5..904b59a 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,4 +1,6 @@ ################################### Basic Configuration ################################### +# 后台服务的版本 +version=v1.4.0 # 工程服务端口,端口被占用则修改 server.port=5003 server.context-path=/WeBASE-Transaction