From 6d74163dc2d9675d0af367c86a0c9c70cbd18cd3 Mon Sep 17 00:00:00 2001 From: zhangxu <3%usVi4iXbVkhI1c> Date: 星期三, 20 七月 2022 10:23:55 +0800 Subject: [PATCH] 修改开放平台成为微服务 --- phi_platform_user/src/main/resources/bootstrap.properties | 12 ++++ phi_platform_user/src/main/java/com/hx/phip/PhiPlatformUserApplication.java | 4 + phi_platform_user/pom.xml | 57 +++++++++++++++++++ phi_platform_user/src/main/java/com/hx/phip/util/api/OrderAddUtil.java | 1 pom.xml | 63 +++++++++++++++++++++ 5 files changed, 137 insertions(+), 0 deletions(-) diff --git a/phi_platform_user/pom.xml b/phi_platform_user/pom.xml index 714cb32..bc2a502 100644 --- a/phi_platform_user/pom.xml +++ b/phi_platform_user/pom.xml @@ -21,6 +21,63 @@ <version>0.0.1-SNAPSHOT</version> <dependencies> + <!--springCloud-nacos--> + <dependency> + <groupId>com.alibaba.cloud</groupId> + <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> + <exclusions> + <exclusion> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-netflix-ribbon</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>com.alibaba.cloud</groupId> + <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> + </dependency> + + <dependency> + <groupId>com.alibaba.cloud</groupId> + <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> + <exclusions> + <exclusion> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-netflix-ribbon</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>com.alibaba.cloud</groupId> + <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> + </dependency> + + <!--spring cloud鐨勬敮鎸�--> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-bootstrap</artifactId> + </dependency> + <!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-context --> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-context</artifactId> + </dependency> + <!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-commons --> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-commons</artifactId> + </dependency> + + <!--openfeign鐨勬敮鎸�--> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-openfeign</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-loadbalancer</artifactId> + </dependency> + <dependency> <groupId>org.springframework.boot</groupId> diff --git a/phi_platform_user/src/main/java/com/hx/phip/PhiPlatformUserApplication.java b/phi_platform_user/src/main/java/com/hx/phip/PhiPlatformUserApplication.java index 705e0e1..819c719 100644 --- a/phi_platform_user/src/main/java/com/hx/phip/PhiPlatformUserApplication.java +++ b/phi_platform_user/src/main/java/com/hx/phip/PhiPlatformUserApplication.java @@ -9,6 +9,8 @@ import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.context.annotation.ComponentScan; @SpringBootApplication @@ -16,6 +18,8 @@ @ComponentScan(basePackages = {"com.gitee.sunchenbin.mybatis.actable.manager.*","com.hx.phip.*","com.hx.common.service.impl","com.hx.redis","com.hx.mybatis.aes.springbean"},nameGenerator = UniqueNameGenerator.class) @ServletComponentScan //@EnableScheduling +@EnableDiscoveryClient +@EnableFeignClients public class PhiPlatformUserApplication extends SpringBootServletInitializer implements CommandLineRunner { public static void main(String[] args) { diff --git a/phi_platform_user/src/main/java/com/hx/phip/util/api/OrderAddUtil.java b/phi_platform_user/src/main/java/com/hx/phip/util/api/OrderAddUtil.java index b94e064..fbbfe2c 100644 --- a/phi_platform_user/src/main/java/com/hx/phip/util/api/OrderAddUtil.java +++ b/phi_platform_user/src/main/java/com/hx/phip/util/api/OrderAddUtil.java @@ -38,6 +38,7 @@ import com.hx.phip.dao.mapper.MemberLevelMapper; import com.hx.phip.dao.mapper.MemberLimitMapper; import com.hx.phip.dao.mapper.OrderDeveloperMapper; +import com.hx.phip.dao.mapper.OrderInfoMapper; import com.hx.phip.dao.mapper.OrderItemSonMapper; import com.hx.phip.dao.mapper.OrderLogMapper; import com.hx.phip.dao.mapper.OrdersTotalMapper; diff --git a/phi_platform_user/src/main/resources/bootstrap.properties b/phi_platform_user/src/main/resources/bootstrap.properties new file mode 100644 index 0000000..7f8d499 --- /dev/null +++ b/phi_platform_user/src/main/resources/bootstrap.properties @@ -0,0 +1,12 @@ +spring.application.name = phi-platfrom-service +spring.cloud.nacos.discovery.server-addr=1.15.12.102:8848 +spring.cloud.nacos.discovery.group = phiskin + +spring.cloud.nacos.discovery.namespace=e7d83269-bd0f-4ee0-8012-6ffac8966a35 + +spring.cloud.nacos.config.server-addr = 1.15.12.102:8848 +spring.cloud.nacos.config.group = phiskin +spring.cloud.nacos.config.file-extension = properties + +spring.cloud.nacos.config.namespace=e7d83269-bd0f-4ee0-8012-6ffac8966a35 + diff --git a/pom.xml b/pom.xml index d670da7..688e67a 100644 --- a/pom.xml +++ b/pom.xml @@ -65,12 +65,75 @@ <jasypt.version>2.1.2</jasypt.version> <!--瀵硅薄涓嶺ML澶勭悊--> <jaxb.version>2.3.1</jaxb.version> + + <nacos-discovery.version>2021.1</nacos-discovery.version> + <nacos-config.version>2021.1</nacos-config.version> + <bootstrap.version>3.1.0</bootstrap.version> + <cloud-context.version>3.1.0</cloud-context.version> + <cloud-commons.version>3.1.0</cloud-commons.version> + <open.version>3.1.0</open.version> + <openfeign.version>3.1.0</openfeign.version> + <loadbalancer.version>3.1.0</loadbalancer.version> + </properties> <!-- 澹版槑渚濊禆涓嶅紩鍏� --> <dependencyManagement> <dependencies> + <dependency> + <groupId>com.alibaba.cloud</groupId> + <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> + <version>${nacos-discovery.version}</version> + </dependency> + <!-- https://mvnrepository.com/artifact/com.alibaba.cloud/spring-cloud-starter-alibaba-nacos-config --> + <dependency> + <groupId>com.alibaba.cloud</groupId> + <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> + <version>${nacos-config.version}</version> + </dependency> + <!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-bootstrap --> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-bootstrap</artifactId> + <version>${bootstrap.version}</version> + </dependency> + <!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-context --> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-context</artifactId> + <version>${cloud-context.version}</version> + </dependency> + <!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-commons --> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-commons</artifactId> + <version>${cloud-commons.version}</version> + </dependency> + <dependency> + <groupId>com.github.ulisesbocchio</groupId> + <artifactId>jasypt-spring-boot-starter</artifactId> + <version>${jasypt.version}</version> + </dependency> + <!-- openfeign鏀寔--> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-openfeign</artifactId> + <version>${openfeign.version}</version> + </dependency> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-loadbalancer</artifactId> + <version>${loadbalancer.version}</version> + </dependency> + <!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api --> + <dependency> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>${jaxb.version}</version> + </dependency> + + <!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api --> <dependency> <groupId>javax.xml.bind</groupId> -- Gitblit v1.8.0