You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ma...@apache.org on 2019/08/08 01:30:13 UTC

[servicecomb-samples] 34/43: UserCenter service initail version

This is an automated email from the ASF dual-hosted git repository.

mabin pushed a commit to branch houserush-sample
in repository https://gitbox.apache.org/repos/asf/servicecomb-samples.git

commit bfe09ea62ada82082afc3a9b215834f2623e5631
Author: chuck <40...@users.noreply.github.com>
AuthorDate: Tue Aug 6 10:21:48 2019 +0800

    UserCenter service initail version
    
    UserCenter service initail version
---
 houserush/user-center/pom.xml                      |  5 +--
 .../user/center/UserCenterApplication.java         | 42 ++++++++++++++++++++++
 .../houserush/user/center/UserCenterConfig.java    | 24 +++++++++++++
 .../src/main/resources/microservice.yaml           | 34 ++++++++++++++++++
 4 files changed, 103 insertions(+), 2 deletions(-)

diff --git a/houserush/user-center/pom.xml b/houserush/user-center/pom.xml
index 52dc4f6..016e5be 100644
--- a/houserush/user-center/pom.xml
+++ b/houserush/user-center/pom.xml
@@ -17,12 +17,14 @@
   -->
 
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
   <parent>
     <artifactId>houserush</artifactId>
     <groupId>org.apache.servicecomb.samples.practice</groupId>
     <version>0.0.1-SNAPSHOT</version>
   </parent>
+
   <modelVersion>4.0.0</modelVersion>
 
   <artifactId>houserush-user-center</artifactId>
@@ -59,5 +61,4 @@
       </plugin>
     </plugins>
   </build>
-
 </project>
diff --git a/houserush/user-center/src/main/java/org/apache/servicecomb/samples/practise/houserush/user/center/UserCenterApplication.java b/houserush/user-center/src/main/java/org/apache/servicecomb/samples/practise/houserush/user/center/UserCenterApplication.java
new file mode 100644
index 0000000..664c3ed
--- /dev/null
+++ b/houserush/user-center/src/main/java/org/apache/servicecomb/samples/practise/houserush/user/center/UserCenterApplication.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.servicecomb.samples.practise.houserush.user.center;
+
+import org.apache.servicecomb.common.rest.codec.RestObjectMapperFactory;
+import org.apache.servicecomb.springboot.starter.provider.EnableServiceComb;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+import java.text.SimpleDateFormat;
+import java.util.TimeZone;
+
+@SpringBootApplication
+@EnableServiceComb
+public class UserCenterApplication {
+
+    public static void main(String[] args) {
+        configBeforeBoot();
+        SpringApplication.run(UserCenterApplication.class, args);
+    }
+
+    private static void configBeforeBoot() {
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        simpleDateFormat.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
+        RestObjectMapperFactory.getRestObjectMapper().setDateFormat(simpleDateFormat);
+    }
+}
diff --git a/houserush/user-center/src/main/java/org/apache/servicecomb/samples/practise/houserush/user/center/UserCenterConfig.java b/houserush/user-center/src/main/java/org/apache/servicecomb/samples/practise/houserush/user/center/UserCenterConfig.java
new file mode 100644
index 0000000..e9ae84c
--- /dev/null
+++ b/houserush/user-center/src/main/java/org/apache/servicecomb/samples/practise/houserush/user/center/UserCenterConfig.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.servicecomb.samples.practise.houserush.user.center;
+
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class UserCenterConfig {
+}
diff --git a/houserush/user-center/src/main/resources/microservice.yaml b/houserush/user-center/src/main/resources/microservice.yaml
new file mode 100644
index 0000000..e568ad2
--- /dev/null
+++ b/houserush/user-center/src/main/resources/microservice.yaml
@@ -0,0 +1,34 @@
+#
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You 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.
+## ---------------------------------------------------------------------------
+
+# all interconnected microservices must belong to an application wth the same ID
+APPLICATION_ID: houserush
+service_description:
+# name of the declaring microservice
+  name: user-center
+  version: 0.0.2
+servicecomb:
+  service:
+    registry:
+      address: http://192.168.229.134:30100
+  rest:
+    address: 0.0.0.0:6877
+  handler:
+    chain:
+      Provider:
+        default: bizkeeper-provider
\ No newline at end of file