Skip to main content

Springboot Microservices Tools And Dependencies – Spring Cloud Config

There are various tools and dependencies which are available in Spring Starter project which are very useful in creating better spring based microservice architectures for developing mobile or web applications. Here is one such commonly used tools if you are using the springboot microservice architecture in designing your applications.

Spring Cloud Config Server : This dependency is used for externalizing the configuration properties in various microservices present in your organization. The main advantage of using Spring Cloud Config Server is that you can get away from deploying or restarting your services if there is only configuration change made in your microservice. Generally, if you change any property in your microservice, you will have to restart the microservice to see that change. But if you configure your properties in the Spring Cloud Config Server, the changes will be affected automatically in the applications.

Steps to activate this dependency:
·       Create a github repo and place the property files from your microservices in git hub repository.
·       If there are common properties across microservices, then create a file called application.properties.
·       Application specific properties can be placed in files called  “ApplicationName.properties” . For example, if you have defined an application as “Customer”, then Customer application specific poperties will be defined in “Customer.properties”.
  •  Create a new project called “Config-Server” for Config Server. In this springboot starter project just select “Config Server” as dependency
  •        Open application.properties file in “Config-Server” project. Add following properties:
      •      Spring.application.name
      •      Server.port
      •      Spring.cloud.config.server.git.uri=https://github.com/ravivv247/spring-cloud-config
  •        Add class level annotation @EnableConfigServer for the springboot main class file created in “Config-Server” project.
  •        Start the “Config-Server” project. Check the below URL to see if the “Config-Server” is running properly.

Configuring Config Cloud Server in the microservices:
  • Add “spring-cloud-starter-config” dependency in the the microservice.
  • Add bootstrap.properties files under resources folder. Bootstrap context runs even before the application context runs.
  • Add following property in the bootstrap.properties file.
    • Spring.cloud.config.uri = http://localhost:PortOfConfigServer

Comments

Popular posts from this blog

Outsystems Integrations - Connecting to Microsoft Azure Sql Server

In this article, I will show you how to set up your own Microsoft Azure SQL Server Database and then how to integrate this SQL Server database in Outsystems. Create a free Microsoft Azure Account. https://portal.azure.com. Microsoft Azure is a cloud computing service for building, deploying and testing application through Microsoft managed data centers (similar to Amazon’s AWS services) Microsoft provides free accounts with free credit of $200 to spend in the first year of new account. I am using this feature to create a Microsoft Azure SQL Server database in the cloud and will show how easy it is to connect this Azure AQL Server from Outsystems. Click on Add button to add a Azure SQL Database Fill in the details and click on Create button. Your deployment will take few seconds to few min to create. Look for the status in the table. It will change to Created automatically without refreshing the screen and finally when your screen says deployment is compl...

Outsystems Tips and Tricks : Adding iFrame in Reactive Web App

In Outsystems Version 11+, there is no iFrame widget available when you are building Reactive Web Applications. So in case you want to add an iFrame HTML tag or for that matter any other HTML element, you could do so by creating a generic web block and pass HTML in to it by doing as follows.