Parcourir la source

Merge branch 'dev' of chenweida/patient-co-management into dev

chenweida il y a 7 ans
Parent
commit
aebc36f0a5

+ 0 - 77
Jolokia-admin-server/pom.xml

@ -1,77 +0,0 @@
<?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">
    <artifactId>jolokia-admin-server</artifactId>
    <groupId>com.yihu</groupId>
    <version>1.0.0</version>
    <modelVersion>4.0.0</modelVersion>
    <properties>
        <version.spring-framework>4.2.5.RELEASE</version.spring-framework>
        <version.spring-boot>1.3.5.RELEASE</version.spring-boot>
    </properties>
    <dependencies>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-server</artifactId>
            <version>1.3.5</version>
        </dependency>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-server-ui</artifactId>
            <version>1.3.5</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-actuator-docs</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${version.spring-framework}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>jolokia-server</finalName>
        <plugins>
            <!--springboot插件 start-->
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!--springboot插件 en-->
            <!--编译插件 start-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
                <version>3.1</version>
            </plugin>
            <!--编译插件 end-->
        </plugins>
    </build>
</project>

+ 0 - 18
Jolokia-admin-server/src/main/java/com/yihu/wlyy/jolokia/JolokiaApplication.java

@ -1,18 +0,0 @@
package com.yihu.wlyy.jolokia;
import de.codecentric.boot.admin.config.EnableAdminServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Configuration;
/**
 * Created by chenweida on 2017/7/25.
 */
@Configuration
@EnableAutoConfiguration
@EnableAdminServer
public class JolokiaApplication {
    public static void main(String[] args) {
        SpringApplication.run(JolokiaApplication.class, args);
    }
}

+ 0 - 48
Jolokia-admin-server/src/main/java/com/yihu/wlyy/jolokia/config/counter/RestCounter.java

@ -1,48 +0,0 @@
package com.yihu.wlyy.jolokia.config.counter;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.metrics.CounterService;
import org.springframework.boot.actuate.metrics.GaugeService;
import org.springframework.stereotype.Component;
/**
 * Created by chenweida on 2017/7/25.
 * 访问的接口计数器
 */
@Aspect
@Component
public class RestCounter {
    @Autowired
    private CounterService counterService;
    @Autowired
    private GaugeService gaugeService;
    /**
     * 统计访问接口的次数
     * @param joinPoint
     */
    @Before("execution(* com.test.bookpub.controller.*.*(..))")
    public void countServiceInvoke(JoinPoint joinPoint) {
        counterService.increment(joinPoint.getSignature() + "");
    }
    /**
     * 计算访问接口的耗时数
     * @param pjp
     * @throws Throwable
     */
    @Around("execution(* com.test.bookpub.controller.*.*(..))")
    public void latencyService(ProceedingJoinPoint pjp) throws Throwable {
        long start = System.currentTimeMillis();
        pjp.proceed();
        long end = System.currentTimeMillis();
        gaugeService.submit(pjp.getSignature().toString(), end - start);
    }
}

+ 0 - 22
Jolokia-admin-server/src/main/resources/application.yml

@ -1,22 +0,0 @@
server:
  port: 8082
spring:
  boot:
    admin:
      url: http://localhost:${server.port}
  jackson:
    serialization:
      indent_output: true
  aop:
    auto: true
endpoints:
    enabled: true
    jmx:
        enabled: true
    jolokia:
        enabled: true
#management:
#    security:
#        enabled: false