Skip to content

Commit

Permalink
add upms module
Browse files Browse the repository at this point in the history
  • Loading branch information
leeyh.lee committed Jul 24, 2018
1 parent ec87e4c commit ad6082f
Show file tree
Hide file tree
Showing 12 changed files with 240 additions and 47 deletions.
20 changes: 0 additions & 20 deletions mudfrog-config/src/test/java/com/smarthane/AppTest.java

This file was deleted.

1 change: 0 additions & 1 deletion mudfrog-eureka/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<artifactId>mudfrog-eureka</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>mudfrog-eureka</name>

<description>eureka server</description>

<dependencies>
Expand Down
20 changes: 0 additions & 20 deletions mudfrog-eureka/src/test/java/com/smarthane/AppTest.java

This file was deleted.

14 changes: 9 additions & 5 deletions mudfrog-gateway/src/main/resources/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@ server:
spring:
application:
name: mudfrog-api-gateway

profiles:
active: dev

eureka:
instance:
prefer-ip-address: true
lease-renewal-interval-in-seconds: 5
lease-expiration-duration-in-seconds: 20
lease-renewal-interval-in-seconds: 5 #定义服务续约任务的调用间隔默认为30秒
lease-expiration-duration-in-seconds: 20 #定义服务失效时间默认为90秒
client:
# fetch-registry: false # 注册中心的职责就是维护服务实例,它并不需要云检索服务
# register-with-eureka: false # 不向注册中心注册自己
serviceUrl:
defaultZone: http://localhost:1025/eureka/
registry-fetch-interval-seconds: 10
defaultZone: http://mudfrog:mudfrog@localhost:1025/eureka/ #启用安全校验http://mudfrog:mudfrog@localhost:1025/eureka
registry-fetch-interval-seconds: 10 #缓存服务地址清单的更新时间默认为30秒

management:
port: 54002
Expand Down
49 changes: 49 additions & 0 deletions mudfrog-modules/mudfrog-upms-service/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?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>
<groupId>com.smarthane</groupId>
<artifactId>mudfrog-modules</artifactId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>mudfrog-upms-service</artifactId>
<version>1.0.0</version>
<name>mudfrog UPMS service</name>
<description>User Permissions Management System</description>

<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<finalName>${project.name}</finalName>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.smarthane.upms;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

/**
* Created with by smarthane-cloud-microservice.
*
* @author: smarthane
* @Date: 2018/7/24 15:34
* @Description:
*/
@SpringBootApplication
@EnableDiscoveryClient
public class MudfrogUpmsApplication {

public static void main(String[] args) {
SpringApplication.run(MudfrogUpmsApplication.class, args);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.smarthane.upms.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* Created with by smarthane-cloud-microservice.
*
* @author: smarthane
* @Date: 2018/7/24 15:46
* @Description:
*/
@RestController
public class TestController {

@Value("${test}")
private String test;

@GetMapping("/test")
public String test() {
return this.test;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.smarthane.upms.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;

/**
* Created with by smarthane-cloud-microservice.
*
* @author: smarthane
* @Date: 2018/7/24 15:55
* @Description:
*/
@Entity
@Table(name = "test")
public class Test implements Serializable {

private static final long serialVersionUID = -1756087696221171302L;

@Id
@Column(name = "code", length = 128)
private String code;

@Column(name = "name", length = 128)
private String name;

public String getCode() {
return code;
}

public void setCode(String code) {
this.code = code;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
server:
port: 20001

spring:
application:
name: mudfrog-upms-service
profiles:
active: dev
cloud:
config:
fail-fast: true
discovery:
service-id: mudfrog-config-server
enabled: true
profile: ${spring.profiles.active}
label: ${spring.profiles.active}

---
spring:
profiles: dev
eureka:
instance:
prefer-ip-address: true
lease-renewal-interval-in-seconds: 5 #定义服务续约任务的调用间隔默认为30秒
lease-expiration-duration-in-seconds: 20 #定义服务失效时间默认为90秒
client:
# fetch-registry: false # 注册中心的职责就是维护服务实例,它并不需要云检索服务
# register-with-eureka: false # 不向注册中心注册自己
serviceUrl:
defaultZone: http://mudfrog:mudfrog@localhost:1025/eureka/ #启用安全校验http://mudfrog:mudfrog@localhost:1025/eureka
registry-fetch-interval-seconds: 10 #缓存服务地址清单的更新时间默认为30秒
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false" scan="false">
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue="pig"/>
<property name="log.path" value="logs/${spring.application.name}" />
<!-- Console log output -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{MM-dd HH:mm:ss.SSS} %-5level [%logger{50}] - %msg%n</pattern>
</encoder>
</appender>

<!-- Log file debug output -->
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/debug.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
</appender>

<!-- Log file error output -->
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>

<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root level="INFO">
<appender-ref ref="console" />
<appender-ref ref="debug" />
<appender-ref ref="error" />
</root>
</configuration>
1 change: 1 addition & 0 deletions mudfrog-modules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<module>mudfrog-biz-samples</module>
<module>mudfrog-dubbo-api</module>
<module>mudfrog-dubbo-biz</module>
<module>mudfrog-upms-service</module>
</modules>
<name>mudfrog-modules</name>

Expand Down
14 changes: 13 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<artifactId>mudfrog</artifactId>
<version>${mudfrog.version}</version>
<packaging>pom</packaging>
<inceptionYear>2018</inceptionYear>
<name>mudfrog microservice</name>
<description>A microservice framework base on springcloud components</description>

<parent>
<groupId>org.springframework.boot</groupId>
Expand All @@ -15,6 +18,16 @@
<relativePath/> <!-- lookup parent from repository -->
</parent>

<developers>
<developer>
<name>smarthane</name>
<email>[email protected]</email>
<roles>
<role>Architect</role>
</roles>
</developer>
</developers>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
Expand Down Expand Up @@ -60,7 +73,6 @@
<module>mudfrog-bigdatas</module>
</modules>


<!--公共依赖-->
<dependencies>
<!--注册中心-->
Expand Down

0 comments on commit ad6082f

Please sign in to comment.