Skip to content

Commit

Permalink
Spring Cloud 系列
Browse files Browse the repository at this point in the history
  • Loading branch information
huzhicheng committed Mar 21, 2019
0 parents commit efa3378
Show file tree
Hide file tree
Showing 114 changed files with 3,890 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
_Store
*/.DS_Store
*.swp
.idea
*.iml

target
88 changes: 88 additions & 0 deletions actuator/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?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>parent</artifactId>
<groupId>kite.springcloud</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<groupId>kite.springcloud</groupId>
<artifactId>actuator</artifactId>

<name>actuator</name>


<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>
</properties>

<dependencies>

<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>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package kite.springcloud.actuator;


import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
*
* 启动类
* @author fengzheng
*/
@SpringBootApplication
public class ActuatorApplication {

public static void main(String[] args) {
SpringApplication.run(ActuatorApplication.class,args);
}
}
19 changes: 19 additions & 0 deletions actuator/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
server:
port: 3201
management:
endpoint:
shutdown:
enabled: false
endpoints:
web:
exposure:
include: "*"
jmx:
exposure:
include: "*"
server:
port: 3208

spring:
application:
name: actuator-application
20 changes: 20 additions & 0 deletions actuator/src/test/java/kite/springcloud/AppTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package kite.springcloud;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

/**
* Unit test for simple App.
*/
public class AppTest
{
/**
* Rigorous Test :-)
*/
@Test
public void shouldAnswerWithTrue()
{
assertTrue( true );
}
}
82 changes: 82 additions & 0 deletions admin/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?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>parent</artifactId>
<groupId>kite.springcloud</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<groupId>kite.springcloud</groupId>
<artifactId>admin</artifactId>

<name>admin</name>

<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>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
13 changes: 13 additions & 0 deletions admin/src/main/java/kite/springcloud/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package kite.springcloud;

/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
20 changes: 20 additions & 0 deletions admin/src/test/java/kite/springcloud/AppTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package kite.springcloud;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

/**
* Unit test for simple App.
*/
public class AppTest
{
/**
* Rigorous Test :-)
*/
@Test
public void shouldAnswerWithTrue()
{
assertTrue( true );
}
}
30 changes: 30 additions & 0 deletions common/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?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>parent</artifactId>
<groupId>kite.springcloud</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<groupId>kite.springcloud</groupId>
<artifactId>common</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-messaging</artifactId>
<version>5.0.5.BUILD-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream</artifactId>
<version>1.3.2.RELEASE</version>
<scope>compile</scope>
</dependency>
</dependencies>


</project>
34 changes: 34 additions & 0 deletions common/src/main/java/kite/springcloud/common/stream/LogInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package kite.springcloud.common.stream;

import lombok.Data;

import java.util.Date;


/**
* LogInfo
*
* @author fengzheng
* @date 2018/12/26
*/
@Data
public class LogInfo {

private String clientVersion;

private String userId;

private String clientIp;

private Date time;

@Override
public String toString() {
return "LogInfo{" +
"clientVersion='" + clientVersion + '\'' +
", userId='" + userId + '\'' +
", clientIp='" + clientIp + '\'' +
", time=" + time +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package kite.springcloud.common.stream;

import org.springframework.integration.support.MessageBuilder;
import org.springframework.messaging.Message;

/**
* MessageUtil
*
* @author fengzheng
* @date 2018/12/20
*/
public class MessageUtil {

public static <T> Message<T> message(T message){
return MessageBuilder.withPayload(message).build();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package kite.springcloud.common.stream;

import org.springframework.cloud.stream.annotation.Input;
import org.springframework.cloud.stream.annotation.Output;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.SubscribableChannel;
import org.springframework.stereotype.Component;

/**
* MyProcessor
*
* @author fengzheng
* @date 2018/12/20
*/
@Component
public interface MyProcessor {

String MESSAGE_INPUT = "log_input";

String MESSAGE_OUTPUT = "log_output";

String LOG_FORMAT_INPUT = "log_format_input";

String LOG_FORMAT_OUTPUT = "log_format_output";

@Input(MESSAGE_INPUT)
SubscribableChannel logInput();

@Output(MESSAGE_OUTPUT)
MessageChannel logOutput();

@Input(LOG_FORMAT_INPUT)
SubscribableChannel logFormatInput();

@Output(LOG_FORMAT_OUTPUT)
MessageChannel logFormatOutput();

}
Loading

0 comments on commit efa3378

Please sign in to comment.