Professional Documents
Culture Documents
Micro Services
Micro Services
Configuration Server
******************************************************************************
1. named as “ConfigServer”
spring.cloud.config.server.git.uri: file://${user.home}/config-repo
management.security.enabled=false
5. Run Config Server by right click on the project and Run as SpringBoot App.
8.
***********************************************************************************
Configuration Client
In this section all micro services will be modified to connect with config server. All our micro services will be act
as config clients.
1. Stop all micro services and add the spring cloud config dependency and the actuator ( if the actuator is
not already in place ) to the pom.xml
<dependency>
<group-Id>org.springframework.cloud</group-Id>
<artifact-Id>spring-cloud-starter-config</artifact-Id>
</dependency>
Since we are modifying the spring boot fares microservice from the earlier project. We will have to add
the following to include the spring cloud dependencies.
<dependencyManagement>
<dependency>
<group-Id>org.springframework</group-Id>
<artifact-Id>spring-cloud-dependencies</artifact-Id>
<version>Dalston.SR1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencyManagement>
And add configuration server url. Also commit out configuration properties.
#src/main/resources/bootstrap.properties
Spring.appliaction.name=fares.service
Spring.cloud.config.uri=http://localhost:8888
Spring.datasource.driver.class-name=oracle.jdbc.driver.OracleDriver
Spring.datasource.url=jdbc:oracle:thin:@localhost:1521:orcl
Spring.datasource.username=fareuser
Spring.datasource.password=gsr123
Spring.jpa.prperties.hibernate.default_schema=FAREUSER
#Tomcat Settings
Spring.datasource.tomcat.initialSize=20
Spring.dataosurce.tomcat.max-active=25
Spring.jpa.hibernate.ddl-auto=create
Spring.jpa.show-sql=true
Management.security.enabled=false
*** Notes: The “ Fares-service “ is a logical name is given to the fares microservice. This will be treated
as a service ID.The config will look for fares-service.properties in the GIT repository to resolve the
properties.
3 Create a new fares-service.properties under the config-repo folder where the GIT repository was
created. Move service-specific.properties from bootstrap.properties to the new fares-
service.properties file.
# …/config-repo/fares-service.properties
Spring.datasource.driver.class-name=oracle.jdbc.driver.OracleDriver
Spring.datasource.url=jdbc:oracle:thin:@localhost:1521:orcl
Spring.datasource.username=fareuser
Spring.datasource.password=gsr123
Spring.jpa.prperties.hibernate.default_schema=FAREUSER
#Tomcat Settings
Spring.datasource.tomcat.initialSize=20
Spring.dataosurce.tomcat.max-active=25
Spring.jpa.hibernate.ddl-auto=create
Spring.jpa.show-sql=true
Management.security.enabled=false
git add –A
5 Repeat all the above steps in search bookin, check-in-microservice and website.
6. Start all services and website,. Also perform booking and check-in through website using
http://localhost:8001
Username : gsr
Password : gsr123