Here are the list of features provided in the library and the template show cases how to use these features with ease.
<dependency>
<groupId>com.services.micro.commons</groupId>
<artifactId>commons-vip</artifactId>
<version>1.0.0</version>
</dependency>
service:
vip:
enabled: false
- http://localhost:8080/demo/vipStatus
- http://localhost:8080/demo/vipLocalStatus
- http://localhost:8080/demo/vipGlobalStatus
<dependency>
<groupId>com.services.micro.commons</groupId>
<artifactId>commons-jsonp</artifactId>
<version>1.0.0</version>
</dependency>
service:
jsonp:
enabled: true
<dependency>
<groupId>com.services.micro.commons</groupId>
<artifactId>commons-memcache</artifactId>
<version>1.0.0</version>
</dependency>
service:
memcache:
enabled: true
configs:
- ttl: 3600
servers: localhost:11211
name: default
- ttl: 36000
servers: localhost:11211
name: autofill
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>com.services.micro.commons</groupId>
<artifactId>commons-metric</artifactId>
<version>1.0.0</version>
</dependency>
service:
metrics:
dropwizard:
enabled: false
prometheus:
enabled: false
jmx:
enabled: true
- http://localhost:8080/demo/metrics
- http://localhost:8080/demo/dropMetrics
- http://localhost:8080/demo/promMetrics
@Timed
@ExceptionMetered
@LogExecutionTime
public ServiceResponse getResponse(String key) { .. }
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
</dependency>
- http://localhost:8080/demo/hystrix
- http://localhost:8080/demo/hystrix/monitor?stream=http%3A%2F%2Flocalhost%3A8080%2Fdemo%2Fhystrix.stream
<dependency>
<groupId>com.services.micro.commons</groupId>
<artifactId>commons-swagger</artifactId>
<version>1.0.0</version>
</dependency>
service:
swagger:
enabled: true
# base-package: com.micro.services.search.resource
@ApiOperation(
value = "Get search results ",
notes = "Pass q and other parameters to get relevant suggestions back ",
response = SearchServiceResponse.class
)
public SearchServiceResponse test() throws Exception {...}
<dependency>
<groupId>com.services.micro.commons</groupId>
<artifactId>commons-git</artifactId>
<version>1.0.0</version>
</dependency>
service:
git:
enabled: true
pom.xml
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<failOnNoGitDirectory>false</failOnNoGitDirectory>
</configuration>
</plugin>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>
spring:
zipkin:
base-url: http://localhost:8680/
flush-interval: 15
enabled: false
<dependency>
<groupId>com.services.micro.commons</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.0</version>
</dependency>
service:
logging:
enabled: false
@LogExecutionTime
public ServiceResponse getMessage() { ..}
pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.8</version>
<configuration>
<printFailingErrors>true</printFailingErrors>
<!--<rulesets>-->
<!--<ruleset>example_pmd.xml</ruleset>-->
<!--</rulesets>-->
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
<goal>cpd-check</goal>
</goals>
</execution>
</executions>
</plugin>
pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<executions>
<execution>
<id>check</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
<!--<goal>checkstyle</goal>-->
</goals>
<configuration>
<configLocation>${basedir}/checkstyle.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<failOnViolation>true</failOnViolation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
</configuration>
</execution>
</executions>
</plugin>
pom.xml
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>
<configuration>
<check>
<haltOnFailure>true</haltOnFailure>
<!--<branchRate>95</branchRate>-->
<lineRate>0</lineRate>
<!--<totalBranchRate>5</totalBranchRate>-->
<totalLineRate>0</totalLineRate>
</check>
</configuration>
<executions>
<execution>
<goals>
<goal>clean</goal>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>client</classifier>
<includes>
<include>**/demo/api/**</include>
<include>**/demo/config/**</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>