Spring Cloud Config :: Deep Dive

Spring Cloud Config provides server and client-side support for externalizing configuration in a distributed system.

With the config server we can have a centrlized place to manage the properties / configurations of applications across all environments.

Getting config server up and running is very easy and straight forward.

The default implementation of the config server uses git as storage backend.

The other storage backends available are :

  • File System
  • Jdbc
  • Vault (HarshiCorp)
  • CredHub

Video series of the features / usecases

01 - Config Server setup and Github integration



 

Stay Tuned…! More in pipeline..!

TestNG : Plugin Setup for STS / Eclipse

IntelliJ and few other IDEs have built-in support for TestNG. But if we are using STS or other Eclipse based tools, we are required to install a plugin to enable IDE support for TestNG.

To set up testng plugin for STS / Eclipse, please follow the below steps:

  • Navigate to : Help menu and click on Install New Software
  • In the install window, click on Add and give the following details and click on Add again.
    Name: TestNG
    Location: https://beust.com/eclipse
    

Please wait for few minutes for the components to be downloaded. Once the components are downloaded, you will see something similar to the tree shown below.

  • Select all the compoenents and click Next.
  • Accept the license and proceed with installation.
  • When prompted for, restart your IDE for the installation to complete.

That’s all you need to configure test-ng plugin in sts / eclipse.

Configuring Jacoco in a Maven Project

With reference to my earlier post on configuring jacoco in a gradle project, in this post we shall see how to configure the same in a maven project.

To enable jacoco code coverage in a maven project, just add the below configuration to your pom.xml file in the plugins section.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.1</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<dataFile>target/jacoco.exec</dataFile>
<!-- Sets the output directory for the code coverage report. -->
<outputDirectory>target/jacoco-ut</outputDirectory>
</configuration>
</execution>
</executions>
<configuration>
<systemPropertyVariables>
<jacoco-agent.destfile>target/jacoco.exec</jacoco-agent.destfile>
</systemPropertyVariables>
<excludes>
<exclude>snmaddula/app/domain/*.class</exclude>
<exclude>snmaddula/app/exception/*.class</exclude>
<exclude>snmaddula/app/filter/*.class</exclude>
<exclude>snmaddula/app/App.class</exclude>
</excludes>
</configuration>
</plugin>

Now execute mvn clean test in the project directory. Navigate to target and open jacoco report file in a web browser to view the coverage report.

That’s all you need to configure jacoco in a maven project.