Skip to content

Commit

Permalink
add common
Browse files Browse the repository at this point in the history
add nacos-client
  • Loading branch information
Marcher committed Aug 8, 2022
1 parent 07cc337 commit 1c21ac5
Show file tree
Hide file tree
Showing 21 changed files with 530 additions and 114 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ rms-mall(real-micro-services-mall) 真微服务商城,由于本人从网上找
| 模块 | 功能 | 端口 |
| ---- | ---- | ---- |
| rms-mall-gateway | 网关 | |
| rms-mall-gateway | 网关 | |
| rms-mall-authority-center | 授权中心 | |
| rms-mall-goods | 商品服务 | |
| rms-mall-order | 订单服务 | |
Expand Down
16 changes: 16 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,24 @@
<modules>
<module>rms-mall-common</module>
<module>rms-mall-goods</module>
<module>rms-mall-authority-center</module>
<module>rms-mall-mvc-config</module>
<module>rms-mall-nacos-client</module>
</modules>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>

</dependencies>

<dependencyManagement>
<dependencies>
<dependency>
Expand Down
94 changes: 94 additions & 0 deletions rms-mall-authority-center/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?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">
<parent>
<artifactId>rms-mall</artifactId>
<groupId>com.wyb.rms</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>rms-mall-authority-center</artifactId>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>com.wyb.rms</groupId>
<artifactId>rms-mall-mvc-config</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>

<!-- nacos config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>

<!-- spring cloud alibaba nacos discovery 依赖 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<!-- MySQL 驱动, 注意, 这个需要与 MySQL 版本对应 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>

<!-- zipkin = spring-cloud-starter-sleuth + spring-cloud-sleuth-zipkin-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.cloud</groupId>-->
<!-- <artifactId>spring-cloud-starter-zipkin</artifactId>-->
<!-- </dependency>-->

<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</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>

<!--
SpringBoot的Maven插件, 能够以Maven的方式为应用提供SpringBoot的支持,可以将
SpringBoot应用打包为可执行的jar或war文件, 然后以通常的方式运行SpringBoot应用
-->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.wyb.rms;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;

/**
* <h1>授权中心启动入口</h1>
*/
@EnableJpaAuditing // 允许 Jpa 自动审计
@EnableDiscoveryClient
@SpringBootApplication
public class AuthorityCenterApplication {

public static void main(String[] args) {

SpringApplication.run(AuthorityCenterApplication.class, args);
}
}
36 changes: 36 additions & 0 deletions rms-mall-authority-center/src/main/resources/bootstrap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
server:
port: 7000
servlet:
context-path: /rms-mall-authority-center

spring:
application:
name: rms-mall-authority-center
cloud:
nacos:
config:
server-addr: 127.0.0.1:8848
namespace:
file-extension: yml
shared-configs:
- dataId: db.yml
group: e-commerce
refresh: true
discovery:
enabled: true # 如果不想使用 Nacos 进行服务注册和发现, 设置为 false 即可
server-addr: 127.0.0.1:8848 # Nacos 服务器地址
# server-addr: 127.0.0.1:8848,127.0.0.1:8849,127.0.0.1:8850 # Nacos 服务器地址
namespace:
metadata:
management:
context-path: ${server.servlet.context-path}/actuator

# 暴露端点
management:
endpoints:
web:
exposure:
include: '*'
endpoint:
health:
show-details: always
63 changes: 1 addition & 62 deletions rms-mall-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,69 +12,8 @@
<version>0.0.1-SNAPSHOT</version>
<artifactId>rms-mall-common</artifactId>
<name>rms-mall-common</name>
<description>common模块</description>
<description>通用模块</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>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.wyb.rms.common.vo;

import lombok.Data;

import java.io.Serializable;

/**
* Description:
*
* @author Marcher丶
* @date 2022-08-08 22:25
**/
@Data
public class CommonResponse<T> implements Serializable {

private static final long serialVersionUID = -1L;

private Integer code;
private Boolean success;
private String msg;
private T data;

public CommonResponse(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
}
Empty file.

This file was deleted.

37 changes: 37 additions & 0 deletions rms-mall-mvc-config/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?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">
<parent>
<artifactId>rms-mall</artifactId>
<groupId>com.wyb.rms</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>rms-mall-mvc-config</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>rms-mall-mvc-config</name>
<description>通用配置模块</description>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>

<dependencies>
<!-- 引入 Web 功能 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.wyb.rms</groupId>
<artifactId>rms-mall-common</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>

</project>
Loading

0 comments on commit 1c21ac5

Please sign in to comment.