-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
wangyb
committed
May 25, 2022
0 parents
commit 07cc337
Showing
15 changed files
with
453 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
HELP.md | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
!**/src/main/**/target/ | ||
!**/src/test/**/target/ | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
build/ | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### VS Code ### | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
## rms-mall(real-micro-services-mall) | ||
|
||
rms-mall(real-micro-services-mall) 真微服务商城,由于本人从网上找的一些商城项目都不算真正的微服务商城,就此想实现真正的基于 | ||
[spring-cloud-alibaba](https://github.com/alibaba/spring-cloud-alibaba/wiki/%E7%89%88%E6%9C%AC%E8%AF%B4%E6%98%8E) | ||
系列组件的微服务商城。计划拥有: | ||
|
||
| 模块 | 功能 | 端口 | | ||
| ---- | ---- | ---- | | ||
| rms-mall-gateway | 网关 | | | ||
| rms-mall-authority-center | 授权中心 | | | ||
| rms-mall-goods | 商品服务 | | | ||
| rms-mall-order | 订单服务 | | | ||
| rms-mall-logistics | 物流服务 | | | ||
| rms-mall-account | 用户服务 | | | ||
| rms-mall-common | 公共模块 | | | ||
|
||
|
||
|
||
库存服务,订单服务,支付服务,卡券服务,物流服务, | ||
|
||
## 组件版本 | ||
| Spring Cloud Alibaba Version | Spring Cloud Version | Spring Boot Version | | ||
| ---- | ---- | ---- | | ||
| 2.2.7.RELEASE | Spring Cloud Hoxton.SR12 | 2.3.12.RELEASE | | ||
|
||
## 更新 | ||
|
||
- 2022/1/20 增加nacos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<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"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.wyb.rms</groupId> | ||
<artifactId>rms-mall</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
|
||
<name>rms-mall</name> | ||
<url>http://www.example.com</url> | ||
<packaging>pom</packaging> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
|
||
<cloud-alibaba.version>2.2.7.RELEASE</cloud-alibaba.version> | ||
<spring-boot.version>2.3.12.RELEASE</spring-boot.version> | ||
<spring-cloud.version>Spring Cloud Hoxton.SR9</spring-cloud.version> | ||
</properties> | ||
|
||
<modules> | ||
<module>rms-mall-common</module> | ||
<module>rms-mall-goods</module> | ||
</modules> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-dependencies</artifactId> | ||
<version>${spring-boot.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.alibaba.cloud</groupId> | ||
<artifactId>spring-cloud-alibaba-dependencies</artifactId> | ||
<version>${cloud-alibaba.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
|
||
</dependencies> | ||
</dependencyManagement> | ||
|
||
|
||
|
||
<build> | ||
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
<configuration> | ||
<fork>true</fork> | ||
<excludes> | ||
<exclude> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
</exclude> | ||
</excludes> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
HELP.md | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
!**/src/main/**/target/ | ||
!**/src/test/**/target/ | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
build/ | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### VS Code ### | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<artifactId>rms-mall</artifactId> | ||
<groupId>com.wyb.rms</groupId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<version>0.0.1-SNAPSHOT</version> | ||
<artifactId>rms-mall-common</artifactId> | ||
<name>rms-mall-common</name> | ||
<description>common模块</description> | ||
|
||
<packaging>jar</packaging> | ||
|
||
<properties> | ||
<java.version>1.8</java.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
|
||
<!-- 服务调用--> | ||
<dependency> | ||
<groupId>com.alibaba.cloud</groupId> | ||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> | ||
</dependency> | ||
|
||
<!-- 配置中心--> | ||
<dependency> | ||
<groupId>com.alibaba.cloud</groupId> | ||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> | ||
</dependency> | ||
|
||
<!-- <dependency>--> | ||
<!-- <groupId>org.springframework.boot</groupId>--> | ||
<!-- <artifactId>spring-boot-devtools</artifactId>--> | ||
<!-- <scope>runtime</scope>--> | ||
<!-- <optional>true</optional>--> | ||
<!-- </dependency>--> | ||
|
||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
<configuration> | ||
<fork>true</fork> | ||
<excludes> | ||
<exclude> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
</exclude> | ||
</excludes> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
22 changes: 22 additions & 0 deletions
22
rms-mall-common/src/main/java/com/wyb/rms/common/config/CommonConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.wyb.rms.common.config; | ||
|
||
import lombok.Data; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.cloud.context.config.annotation.RefreshScope; | ||
import org.springframework.stereotype.Component; | ||
|
||
/** | ||
* @author Marcher丶 | ||
* | ||
* @RefreshScope只能加在获取的地方,加在controller无法刷新 | ||
*/ | ||
@Data | ||
@Component | ||
@RefreshScope | ||
public class CommonConfig { | ||
|
||
@Value("${isNewBusi}") | ||
private Boolean isNewBusi; | ||
|
||
|
||
} |
32 changes: 32 additions & 0 deletions
32
rms-mall-common/src/main/java/com/wyb/rms/common/controller/ServerController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.wyb.rms.common.controller; | ||
|
||
import com.wyb.rms.common.config.CommonConfig; | ||
import org.springframework.cloud.client.ServiceInstance; | ||
import org.springframework.cloud.client.discovery.DiscoveryClient; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import javax.annotation.Resource; | ||
import java.util.List; | ||
|
||
/** | ||
* @author Marcher丶 | ||
*/ | ||
@RestController | ||
public class ServerController { | ||
|
||
@Resource | ||
private DiscoveryClient discoveryClient; | ||
@Resource | ||
private CommonConfig commonConfig; | ||
|
||
@GetMapping("/getServerList") | ||
public List<ServiceInstance> getServiceInstances() { | ||
return discoveryClient.getInstances("rms-mall-common"); | ||
} | ||
|
||
@GetMapping("/getConfig") | ||
public boolean getConfig() { | ||
return commonConfig.getIsNewBusi(); | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
spring: | ||
cloud: | ||
nacos: | ||
config: | ||
server-addr: localhost:8848 | ||
file-extension: yml | ||
sharedConfigs: | ||
- data-id: common.yml | ||
group: DEFAULT_GROUP | ||
refresh: true | ||
- data-id: common2.yml | ||
group: DEFAULT_GROUP | ||
refresh: true | ||
refresh-enabled: true | ||
extensionConfigs: | ||
- data-id: common3.yml | ||
group: DEFAULT_GROUP | ||
refresh: true | ||
- data-id: common4.yml | ||
group: DEFAULT_GROUP | ||
refresh: true | ||
discovery: | ||
server-addr: localhost:8848 | ||
application: | ||
name: rms-mall-common | ||
profiles: | ||
active: dev |
13 changes: 13 additions & 0 deletions
13
rms-mall-common/src/test/java/com/wyb/rms/common/RmsCommonApplicationTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.wyb.rms.common; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
|
||
@SpringBootTest | ||
class RmsCommonApplicationTests { | ||
|
||
@Test | ||
void contextLoads() { | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
HELP.md | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
!**/src/main/**/target/ | ||
!**/src/test/**/target/ | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
build/ | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### VS Code ### | ||
.vscode/ |
Oops, something went wrong.