{"id":93990,"date":"2019-07-08T11:38:18","date_gmt":"2019-07-08T08:38:18","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=93990"},"modified":"2019-07-15T09:34:52","modified_gmt":"2019-07-15T06:34:52","slug":"java-microservices-spring-cloud-config-jhipster","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2019\/07\/java-microservices-spring-cloud-config-jhipster.html","title":{"rendered":"Java Microservices with Spring Cloud Config and JHipster"},"content":{"rendered":"<p><span style=\"font-size: 20px;\"><b>Friends don\u2019t let friends write user auth. Tired of managing your own users?<\/b>  <a href=\"https:\/\/developer.okta.com\/signup\/?utm_campaign=text_website_all_multiple_dev_dev_java-microservices-spring-cloud-config_null&amp;utm_source=jcg&amp;utm_medium=cpc\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Try Okta\u2019s API and Java SDKs today. Authenticate, manage, and secure users in any application within minutes.<\/a><\/span><\/p>\n<p>Developing a microservice architecture with Java and Spring Boot is quite popular these days. It\u2019s definitely one of the most popular combinations in the Java ecosystem. If you need any proof, just look at all of the similar frameworks that have cropped up in the last few years: MicroProfile, Micronaut, and Quarkus, just to name a few.<\/p>\n<p>Spring Boot provided a much-needed spark to the Spring ecosystem when it was first released in 2014. Instead of making Java developers configure all aspects of their Spring beans, it provided &#8220;starters&#8221; that contained pre-configured beans with the default settings. This led to less Java code, and also provided the ability to override the defaults via an&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">application.properties<\/code>&nbsp;file. Yes, there are many ways to modify the defaults in a Spring Boot application, but I\u2019ll skip over that for now.<\/p>\n<p>In a\u00a0<a href=\"https:\/\/developer.okta.com\/blog\/2019\/05\/22\/java-microservices-spring-boot-spring-cloud?utm_campaign=text_website_all_multiple_dev_dev_java-microservices-spring-cloud-config_null&amp;utm_source=jcg&amp;utm_medium=cpc\">previous tutorial on Java Microservices with Spring Boot and Spring Cloud<\/a>, I showed how you can use OAuth 2.0 and OpenID Connect to secure everything. One of the problems with this example is that you have to configure the OIDC properties in each application. This can be a real pain if you have hundreds of microservices. Yes, you could define them as environment variables and this would solve the problem. However, if you have different microservices stacks using different OIDC client IDs, this approach will be difficult.<\/p>\n<h2 class=\"wp-block-heading\" id=\"java-microservices-with-spring-cloud-config\">Java Microservices with Spring Cloud Config<\/h2>\n<p><a href=\"https:\/\/spring.io\/projects\/spring-cloud-config\">Spring Cloud Config<\/a>&nbsp;is a project that provides externalized configuration for distributed systems. Spring Cloud Config has server and client components. You can configure the server to read its configuration from the file system or a source code repository, like Git. On the client, you configure things in a bootstrap configuration file to get configuration data from the server. In a microservices environment, this provides an elegant way to configure&nbsp;<em>all<\/em>&nbsp;your microservices from a central location.<\/p>\n<p>Today I\u2019d like to show you how this works and demo it using one of the hippest microservice solutions I\u2019ve ever worked with.<\/p>\n<h2 class=\"wp-block-heading\" id=\"use-jhipster-to-generate-a-java-microservices-architecture\">Use JHipster to Generate a Java Microservices Architecture<\/h2>\n<p><a href=\"https:\/\/www.jhipster.tech\/\">JHipster<\/a>&nbsp;is a development platform to generate, develop, and deploy Spring Boot + { Angular or React or Vue } applications. In addition, it supports creating Spring-based microservice architectures. In fact, if you create microservices projects and choose OAuth 2.0 \/ OIDC for authentication, you\u2019ll be using code that\u2019s very similar to the aforementioned example.<\/p>\n<p>To use JHipster, you\u2019ll need to have&nbsp;<a href=\"https:\/\/nodejs.org\/\">Node.js<\/a>&nbsp;installed. You can also use&nbsp;<a href=\"https:\/\/start.jhipster.tech\/\">start.jhipster.tech<\/a>, which is similar to start.spring.io.<\/p>\n<p>The most common way to install JHipster is using npm:<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:bash\">npm install -g generator-jhipster@6.0.1<\/pre>\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p> You can run the command above without the version number to get the latest version of JHipster. If it\u2019s 6.x, this tutorial&nbsp;<em>should<\/em>&nbsp;work, but I can\u2019t guarantee it does. <\/p>\n<\/blockquote>\n<p>In a terminal, create a directory to hold all the projects you\u2019re about to create. For example,&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">jhipster<\/code>.<\/p>\n<p>Create an&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">apps.jh<\/code>&nbsp;file in this directory and put the following code into it.<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:js\">application {\n  config {\n    baseName gateway,\n    packageName com.okta.developer.gateway,\n    applicationType gateway,\n    authenticationType oauth2,\n    prodDatabaseType postgresql,\n    serviceDiscoveryType eureka,\n    testFrameworks [protractor]\n  }\n  entities Blog, Post, Tag, Product\n}\n\napplication {\n  config {\n    baseName blog,\n    packageName com.okta.developer.blog,\n    applicationType microservice,\n    authenticationType oauth2,\n    prodDatabaseType postgresql,\n    serverPort 8081,\n    serviceDiscoveryType eureka\n  }\n  entities Blog, Post, Tag\n}\n\napplication {\n  config {\n    baseName store,\n    packageName com.okta.developer.store,\n    applicationType microservice,\n    authenticationType oauth2,\n    databaseType mongodb,\n    devDatabaseType mongodb,\n    prodDatabaseType mongodb,\n    enableHibernateCache false,\n    serverPort 8082,\n    serviceDiscoveryType eureka\n  }\n  entities Product\n}\n\nentity Blog {\n  name String required minlength(3),\n  handle String required minlength(2)\n}\n\nentity Post {\n  title String required,\n  content TextBlob required,\n  date Instant required\n}\n\nentity Tag {\n  name String required minlength(2)\n}\n\nentity Product {\n  title String required,\n  price BigDecimal required min(0),\n  image ImageBlob\n}\n\nrelationship ManyToOne {\n  Blog{user(login)} to User,\n  Post{blog(name)} to Blog\n}\n\nrelationship ManyToMany {\n  Post{tag(name)} to Tag{post}\n}\n\npaginate Post, Tag with infinite-scroll\npaginate Product with pagination\n\nmicroservice Product with store\nmicroservice Blog, Post, Tag with blog\n\n\/\/ will be created under 'docker-compose' folder\ndeployment {\n  deploymentType docker-compose\n  appsFolders [gateway, blog, store]\n  dockerRepositoryName \"jmicro\"\n  consoleOptions [zipkin]\n}\n<\/pre>\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p> You\u2019ll want to change the&nbsp;<code>dockerRepositoryName<\/code>&nbsp;in the JDL above to use your&nbsp;<a href=\"https:\/\/hub.docker.com\/\">Docker Hub<\/a>&nbsp;username if you want to publish your containers. This is not a necessary step to complete this tutorial. <\/p>\n<\/blockquote>\n<p>This code is JDL (JHipster Domain Language) and you can use it to define your app, its entities, and even deployment settings. You can learn more about JDL in&nbsp;<a href=\"https:\/\/www.jhipster.tech\/jdl\/\">JHipster\u2019s JDL documentation<\/a>. Below is a screenshot of JDL Studio, which can be used to edit JDL and see how entities related to each other.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/jdl-studio-1024x680.png\" alt=\"Java Microservices\" class=\"wp-image-93995\" width=\"768\" height=\"510\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/jdl-studio-1024x680.png 1024w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/jdl-studio-300x199.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/jdl-studio-768x510.png 768w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/jdl-studio.png 1600w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/figure>\n<\/div>\n<p>The JDL you just put in&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">apps.jh<\/code>&nbsp;defines three applications:<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>gateway<\/strong>: a single entry point to your microservices, that will include the UI components.<\/li>\n<li><strong>blog<\/strong>: a blog service that talks to PostgreSQL.<\/li>\n<li><strong>store<\/strong>: a store service that uses MongoDB.<\/li>\n<\/ul>\n<p>Run the following command to create these projects in your&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">jhipster<\/code>&nbsp;folder.<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:bash\">jhipster import-jdl apps.jh<\/pre>\n<p>This will create all three projects in parallel. You can watch the console recording below to see how it looks. The time it takes to create everything will depend on how fast your computer and internet are.<br \/><script id=\"asciicast-246951\" src=\"https:\/\/asciinema.org\/a\/246951.js\" async=\"\"><\/script><\/p>\n<h3 class=\"wp-block-heading\" id=\"create-docker-images-for-microservice-apps\">Create Docker Images for Microservice Apps<\/h3>\n<p>When the configuration is generated for Docker Compose, a warning is spat out to the console.<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:bash\">WARNING! Docker Compose configuration generated, but no Jib cache found\nIf you forgot to generate the Docker image for this application, please run:\nTo generate the missing Docker image(s), please run:\n  .\/mvnw -Pprod verify jib:dockerBuild in \/Users\/mraible\/java-microservices-examples\/jhipster\/gateway\n  .\/mvnw -Pprod verify jib:dockerBuild in \/Users\/mraible\/java-microservices-examples\/jhipster\/blog\n  .\/mvnw -Pprod verify jib:dockerBuild in \/Users\/mraible\/java-microservices-examples\/jhipster\/store\n<\/pre>\n<p>To make it easier to create Docker images with one command, create an aggregator&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">pom.xml<\/code>&nbsp;in the&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">jhipster<\/code>&nbsp;root directory.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:xml\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\n&lt;project xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\n    xsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"&gt;\n    &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\n    &lt;groupId&gt;com.okta.developer&lt;\/groupId&gt;\n    &lt;artifactId&gt;jhipster-parent&lt;\/artifactId&gt;\n    &lt;version&gt;1.0.0-SNAPSHOT&lt;\/version&gt;\n    &lt;packaging&gt;pom&lt;\/packaging&gt;\n    &lt;name&gt;jhipster-parent&lt;\/name&gt;\n    &lt;modules&gt;\n        &lt;module&gt;gateway&lt;\/module&gt;\n        &lt;module&gt;blog&lt;\/module&gt;\n        &lt;module&gt;store&lt;\/module&gt;\n    &lt;\/modules&gt;\n&lt;\/project&gt;\n<\/pre>\n<p>Then &#8220;just jib it&#8221; using&nbsp;<a href=\"https:\/\/github.com\/GoogleContainerTools\/jib\">Jib<\/a><\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:bash\">mvn -Pprod verify com.google.cloud.tools:jib-maven-plugin:dockerBuild<\/pre>\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>If you don\u2019t have Maven installed, use&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">brew install maven<\/code>&nbsp;on a Mac, or see&nbsp;<a href=\"https:\/\/maven.apache.org\/install.html\">Maven\u2019s installation docs<\/a>.<\/p>\n<\/blockquote>\n<pre class=\"wp-block-preformatted gutter: false;brush:bash\">[INFO] Skipping containerization because packaging is 'pom'...\n[INFO] ------------------------------------------------------------------------\n[INFO] Reactor Summary:\n[INFO]\n[INFO] Gateway 0.0.1-SNAPSHOT ............................. SUCCESS [02:44 min]\n[INFO] Blog 0.0.1-SNAPSHOT ................................ SUCCESS [ 34.391 s]\n[INFO] Store 0.0.1-SNAPSHOT ............................... SUCCESS [ 28.589 s]\n[INFO] jhipster-parent 1.0.0-SNAPSHOT ..................... SUCCESS [  1.096 s]\n[INFO] ------------------------------------------------------------------------\n[INFO] BUILD SUCCESS\n[INFO] ------------------------------------------------------------------------\n[INFO] Total time: 03:49 min\n[INFO] Finished at: 2019-05-17T07:44:39-06:00\n[INFO] ------------------------------------------------------------------------\nExecution time: 3 min. 50 s.\n<\/pre>\n<h3 class=\"wp-block-heading\" id=\"run-your-java-microservices-stack-with-docker-compose\">Run Your Java Microservices Stack with Docker Compose<\/h3>\n<p>Once everything has finished building, cd into the&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">docker-compose<\/code>&nbsp;directory and start all your containers.<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:bash\">cd docker-compose\ndocker-compose up -d\n<\/pre>\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p> Remove the&nbsp;<code>-d<\/code>&nbsp;if you want to see all the logs in your current terminal window. <\/p>\n<\/blockquote>\n<p>It will take several minutes to start all eight of your containers. You can use&nbsp;<a href=\"https:\/\/kitematic.com\/\">Kitematic<\/a>&nbsp;to monitor their startup progress if you like.<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:bash\">Creating docker-compose_gateway-app_1                ... done\nCreating docker-compose_gateway-postgresql_1         ... done\nCreating docker-compose_blog-app_1                   ... done\nCreating docker-compose_store-mongodb_1              ... done\nCreating docker-compose_keycloak_1                   ... done\nCreating docker-compose_blog-postgresql_1            ... done\nCreating docker-compose_jhipster-registry_1          ... done\nCreating docker-compose_store-app_1                  ... done\n<\/pre>\n<h3 class=\"wp-block-heading\" id=\"jhipster-registry-for-service-discovery-with-java-microservices\">JHipster Registry for Service Discovery with Java Microservices<\/h3>\n<p>This microservices stack uses Eureka for service discovery, just like the bare-bones Spring Boot + Spring Cloud example. This was determined by the following line for each app in the JDL.<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:bash\">serviceDiscoveryType eureka<\/pre>\n<p>When you select&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">eureka<\/code>&nbsp;for service discovery,&nbsp;<a href=\"https:\/\/github.com\/jhipster\/jhipster-registry\">JHipster Registry<\/a>&nbsp;is used. This application is very similar to Eureka Server, except it has an Angular UI and includes&nbsp;<a href=\"https:\/\/spring.io\/projects\/spring-cloud-config\">Spring Cloud Config<\/a>, among other features.<\/p>\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p> JHipster also&nbsp;<a href=\"https:\/\/www.jhipster.tech\/consul\/\">supports Hashicorp Consul<\/a>&nbsp;for service discovery. <\/p>\n<\/blockquote>\n<p>Because you chose OAuth 2.0\/OIDC for authentication, you\u2019ll need to create an entry in your&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">hosts<\/code>&nbsp;file (<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">\/etc\/hosts<\/code>&nbsp;on Linux\/Mac,&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">C:\\Windows\\System32\\Drivers\\etc\\hosts<\/code>&nbsp;on Windows) for Keycloak.<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:bash\">127.0.0.1  keycloak<\/pre>\n<p>This is because the Docker network recognizes&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">keycloak<\/code>&nbsp;as a registered hostname, but it also redirects you to&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">keycloak<\/code>. Your browser is not aware of that hostname without the&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">hosts<\/code>&nbsp;entry.<\/p>\n<p>Open your browser and navigate to&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\"><a class=\"bare\" href=\"http:\/\/localhost:8761\/\">http:\/\/localhost:8761<\/a><\/code>. You\u2019ll be redirected to Keycloak to login. Enter&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">admin\/admin<\/code>&nbsp;for credentials and you\u2019ll be redirected back to JHipster Registry. You\u2019ll see all your microservice instances have been registered.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/jhipster-registry-1024x745.png\" alt=\"Java Microservices\" class=\"wp-image-93996\" width=\"768\" height=\"559\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/jhipster-registry-1024x745.png 1024w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/jhipster-registry-300x218.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/jhipster-registry-768x559.png 768w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/jhipster-registry.png 1600w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/figure>\n<\/div>\n<p>Navigate to&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\"><a class=\"bare\" href=\"http:\/\/localhost:8080\/\">http:\/\/localhost:8080<\/a><\/code>, click&nbsp;<strong>sign in<\/strong>, and you\u2019ll be logged in to the gateway. You can go to&nbsp;<strong>Entities<\/strong>&nbsp;&gt;&nbsp;<strong>Blog<\/strong>&nbsp;and add a blog.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/blog-list-1024x471.png\" alt=\"Java Microservices\" class=\"wp-image-93997\" width=\"768\" height=\"353\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/blog-list-1024x471.png 1024w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/blog-list-300x138.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/blog-list-768x353.png 768w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/blog-list.png 1600w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/figure>\n<\/div>\n<p>Go to&nbsp;<strong>Entities<\/strong>&nbsp;&gt;&nbsp;<strong>Product<\/strong>&nbsp;and you can add a product too.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/product-list-1024x523.png\" alt=\"Java Microservices\" class=\"wp-image-93998\" width=\"768\" height=\"392\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/product-list-1024x523.png 1024w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/product-list-300x153.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/product-list-768x392.png 768w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/product-list.png 1600w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/figure>\n<\/div>\n<p>Pretty slick, don\u2019t you think?!<\/p>\n<h2 class=\"wp-block-heading\" id=\"configure-jhipster-microservices-to-use-okta-for-identity\">Configure JHipster Microservices to Use Okta for Identity<\/h2>\n<p>One of the problems you saw in the bare-bones Spring Boot + Spring Cloud setup is you have to configure&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">okta.oauth2.*<\/code>properties in every microservice. JHipster doesn\u2019t use the Okta Spring Boot starter. It uses&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">oauth2-client<\/code>&nbsp;and&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">oauth2-resource-server<\/code>&nbsp;Spring Boot starters instead. The configuration for OAuth 2.0 is contained in each app\u2019s&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">src\/main\/resources\/config\/application.yml<\/code>&nbsp;file.<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:bash\">spring:\n  ...\n  security:\n    oauth2:\n      client:\n        provider:\n          oidc:\n            issuer-uri: http:\/\/localhost:9080\/auth\/realms\/jhipster\n        registration:\n          oidc:\n            client-id: internal\n            client-secret: internal\n<\/pre>\n<h3 class=\"wp-block-heading\" id=\"why-okta\">Why Okta?<\/h3>\n<p>You might be wondering why you should use Okta instead of Keycloak? Keycloak works great for development and testing, and especially well if you\u2019re on a plane with no wi-fi. However, in production, you want a system that\u2019s&nbsp;<strong>always on<\/strong>. That\u2019s where Okta comes in. To begin, you\u2019ll need to create an Okta account and an application with it.<\/p>\n<h3 class=\"wp-block-heading\" id=\"create-a-web-application-in-okta\">Create a Web Application in Okta<\/h3>\n<p>Log in to your Okta Developer account (or\u00a0<a href=\"https:\/\/developer.okta.com\/signup\/?utm_campaign=text_website_all_multiple_dev_dev_java-microservices-spring-cloud-config_null&amp;utm_source=jcg&amp;utm_medium=cpc\">sign up<\/a>\u00a0if you don\u2019t have an account).<\/p>\n<ol class=\"arabic wp-block-list\">\n<li>From the&nbsp;<strong>Applications<\/strong>&nbsp;page, choose&nbsp;<strong>Add Application<\/strong>.<\/li>\n<li>On the Create New Application page, select&nbsp;<strong>Web<\/strong>.<\/li>\n<li>Give your app a memorable name, add&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\"><a class=\"bare\" href=\"http:\/\/localhost:8080\/login\/oauth2\/code\/okta\">http:\/\/localhost:8080\/login\/oauth2\/code\/okta<\/a><\/code>&nbsp;as a Login redirect URI, select&nbsp;<strong>Refresh Token<\/strong>&nbsp;(in addition to&nbsp;<strong>Authorization Code<\/strong>), and click&nbsp;<strong>Done<\/strong>.<\/li>\n<li>To configure Logout to work in JHipster,&nbsp;<strong>Edit<\/strong>&nbsp;your app, add&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\"><a class=\"bare\" href=\"http:\/\/localhost:8080\/\">http:\/\/localhost:8080<\/a><\/code>&nbsp;as a Logout redirect URI, then click&nbsp;<strong>Save<\/strong>.<\/li>\n<\/ol>\n<h2 class=\"wp-block-heading\" id=\"configure-your-openid-connect-settings-with-spring-cloud-config\">Configure Your OpenID Connect Settings with Spring Cloud Config<\/h2>\n<p>Rather than modifying each of your apps for Okta, you can use Spring Cloud Config in JHipster Registry to do it. Open&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">docker-compose\/central-server-config\/application.yml<\/code>&nbsp;and add your Okta settings.<\/p>\n<p>The client ID and secret are available on your app settings page. You can find the issuer under&nbsp;<strong>API<\/strong>&nbsp;&gt;&nbsp;<strong>Authorization Servers<\/strong>.<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:bash\">spring:\n  security:\n    oauth2:\n      client:\n        provider:\n          oidc:\n            issuer-uri: https:\/\/{yourOktaDomain}\/oauth2\/default\n        registration:\n          oidc:\n            client-id: {yourClientId}\n            client-secret: {yourClientSecret}\n<\/pre>\n<p>The registry, gateway, blog, and store applications are all configured to read this configuration on startup.<\/p>\n<p>Restart all your containers for this configuration to take effect.<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:bash\">docker-compose restart<\/pre>\n<p>Before you can log in, you\u2019ll need to add redirect URIs for JHipster Registry, ensure your user is in a&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">ROLE_ADMIN<\/code>&nbsp;group and that groups are included in the ID token.<\/p>\n<p>Log in to your Okta dashboard, edit your OIDC app, and add the following Login redirect URI:<\/p>\n<ul class=\"wp-block-list\">\n<li><code class=\"highlighter-rouge\" style=\"font-size: 13px;\"><a class=\"bare\" href=\"http:\/\/localhost:8761\/login\/oauth2\/code\/oidc\">http:\/\/localhost:8761\/login\/oauth2\/code\/oidc<\/a><\/code><\/li>\n<\/ul>\n<p>You\u2019ll also need to add a Logout redirect URI:<\/p>\n<ul class=\"wp-block-list\">\n<li><code class=\"highlighter-rouge\" style=\"font-size: 13px;\"><a class=\"bare\" href=\"http:\/\/localhost:8761\/\">http:\/\/localhost:8761<\/a><\/code><\/li>\n<\/ul>\n<p>Then, click&nbsp;<strong>Save<\/strong>.<\/p>\n<h3 class=\"wp-block-heading\" id=\"create-groups-and-add-them-as-claims-to-the-id-token\">Create Groups and Add Them as Claims to the ID Token<\/h3>\n<p>JHipster is configured by default to work with two types of users: administrators and users. Keycloak is configured with users and groups automatically, but you need to do some one-time configuration for your Okta organization.<\/p>\n<p>Create a&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">ROLE_ADMIN<\/code>&nbsp;group (<strong>Users<\/strong>&nbsp;&gt;&nbsp;<strong>Groups<\/strong>&nbsp;&gt;&nbsp;<strong>Add Group<\/strong>) and add your user to it. Navigate to&nbsp;<strong>API<\/strong>&nbsp;&gt;&nbsp;<strong>Authorization Servers<\/strong>, and click on the the&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">default<\/code>&nbsp;server. Click the&nbsp;<strong>Claims<\/strong>&nbsp;tab and&nbsp;<strong>Add Claim<\/strong>. Name it&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">groups<\/code>, and include it in the ID Token. Set the value type to&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">Groups<\/code>&nbsp;and set the filter to be a Regex of&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">.*<\/code>. Click&nbsp;<strong>Create<\/strong>.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/add-claim-1024x841.png\" alt=\"Java Microservices\" class=\"wp-image-93999\" width=\"768\" height=\"631\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/add-claim-1024x841.png 1024w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/add-claim-300x246.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/add-claim-768x631.png 768w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/add-claim.png 1226w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/figure>\n<\/div>\n<p>Now when you hit&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\"><a class=\"bare\" href=\"http:\/\/localhost:8761\/\">http:\/\/localhost:8761<\/a><\/code>&nbsp;or&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\"><a class=\"bare\" href=\"http:\/\/localhost:8080\/\">http:\/\/localhost:8080<\/a><\/code>, you\u2019ll be prompted to log in with Okta!<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/jhipster-okta-login-1024x659.png\" alt=\"Java Microservices\" class=\"wp-image-94000\" width=\"768\" height=\"494\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/jhipster-okta-login-1024x659.png 1024w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/jhipster-okta-login-300x193.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/jhipster-okta-login-768x494.png 768w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/jhipster-okta-login.png 1600w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/figure>\n<\/div>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/jhipster-okta-success-1024x619.png\" alt=\"Java Microservices\" class=\"wp-image-94001\" width=\"768\" height=\"464\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/jhipster-okta-success-1024x619.png 1024w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/jhipster-okta-success-300x181.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/jhipster-okta-success-768x464.png 768w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/jhipster-okta-success.png 1600w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/figure>\n<\/div>\n<p>It\u2019s pretty nifty how you can configure your service registry and all your microservices in one place with Spring Cloud Config, don\u2019t you think?! \ud83d\udc4c<\/p>\n<h2 class=\"wp-block-heading\" id=\"configuring-spring-cloud-config-with-git\">Configuring Spring Cloud Config with Git<\/h2>\n<p>JHipster Registry and its Spring Cloud Config server support two kinds of configuration sources:&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">native<\/code>&nbsp;and&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">git<\/code>. Which one is used is determined by a&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">spring.cloud.config.server.composite<\/code>&nbsp;property. If you look in&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">docker-compose\/jhipster-registry.yml<\/code>, you\u2019ll see that&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">native<\/code>&nbsp;is enabled and&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">git<\/code>&nbsp;is commented out.<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:bash\">- SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_TYPE=native\n- SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_SEARCH_LOCATIONS=file:.\/central-config\n# - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_TYPE=git\n# - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_URI=https:\/\/github.com\/jhipster\/jhipster-registry\/\n# - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_SEARCH_PATHS=central-config\n# For Keycloak to work, you need to add '127.0.0.1 keycloak' to your hosts file\n<\/pre>\n<p>You can see the default configuration for Git at&nbsp;<a href=\"https:\/\/github.com\/jhipster\/jhipster-registry\/blob\/master\/central-config\/application.yml\">@jhipster\/jhipster-registry\/central-config\/application.yml<\/a>. You can learn more about application configuration with Spring Cloud Config in&nbsp;<a href=\"https:\/\/www.jhipster.tech\/jhipster-registry\/#-application-configuration-with-spring-cloud-config\">JHipster Registry\u2019s documentation<\/a>. It includes a section on encrypting configuration values.<\/p>\n<h2 class=\"wp-block-heading\" id=\"what-about-kotlin-microservices\">What About Kotlin Microservices?<\/h2>\n<p>In the first post of this series, I told you why I wrote this post in Java:<\/p>\n<p>I wrote this post with Java because it\u2019s the most popular language in the Java ecosystem. However,&nbsp;<a href=\"https:\/\/redmonk.com\/sogrady\/2019\/03\/20\/language-rankings-1-19\/\">Kotlin is on the rise<\/a>, according to RedMonk\u2019s programming language rankings from January 2019.<\/p>\n<p>Spring has excellent support for Kotlin, and you can choose it as a language on start.spring.io. JHipster has support for Kotlin too with its&nbsp;<a href=\"https:\/\/github.com\/jhipster\/jhipster-kotlin\">Kotlin Blueprint<\/a>! A new release was&nbsp;<a href=\"https:\/\/twitter.com\/sendilkumarn\/status\/1129404782035312641\">published last week<\/a>&nbsp;that allows you to create Kotlin-based JHipster apps with&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">khipster<\/code>.<\/p>\n<p>If you\u2019d like to see us write more posts using Kotlin, please let us know in the comments!<\/p>\n<h2 class=\"wp-block-heading\" id=\"learn-more-about-spring-cloud-config-java-microservices-and-jhipster\">Learn More about Spring Cloud Config, Java Microservices, and JHipster<\/h2>\n<p>I hope you enjoyed learning how to build Java microservice architectures with JHipster and configure them with Spring Cloud Config. You learned how to generate everything from a single JDL file, package your apps in Docker containers, run them with Docker Compose, and authenticate with OIDC using Keycloak and Okta.<\/p>\n<p>You can find all the code shown in this tutorial&nbsp;<a href=\"https:\/\/github.com\/oktadeveloper\/java-microservices-examples\">on GitHub<\/a>&nbsp;in the&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">jhipster<\/code>&nbsp;directory.<\/p>\n<p>We\u2019re big fans of Spring Boot, Spring Cloud, and JHipster on this blog. Here are a few other posts you might find interesting:<\/p>\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/developer.okta.com\/blog\/2019\/05\/22\/java-microservices-spring-boot-spring-cloud?utm_campaign=text_website_all_multiple_dev_dev_java-microservices-spring-cloud-config_null&amp;utm_source=jcg&amp;utm_medium=cpc\">Java Microservices with Spring Boot and Spring Cloud<\/a><\/li>\n<li><a href=\"https:\/\/developer.okta.com\/blog\/2019\/04\/01\/spring-boot-microservices-with-kubernetes?utm_campaign=text_website_all_multiple_dev_dev_java-microservices-spring-cloud-config_null&amp;utm_source=jcg&amp;utm_medium=cpc\">Build a Microservice Architecture with Spring Boot and Kubernetes<\/a><\/li>\n<li><a href=\"https:\/\/developer.okta.com\/blog\/2019\/02\/28\/spring-microservices-docker?utm_campaign=text_website_all_multiple_dev_dev_java-microservices-spring-cloud-config_null&amp;utm_source=jcg&amp;utm_medium=cpc\">Build Spring Microservices and Dockerize Them for Production<\/a><\/li>\n<li><a href=\"https:\/\/developer.okta.com\/blog\/2019\/04\/04\/java-11-java-12-jhipster-oidc?utm_campaign=text_website_all_multiple_dev_dev_java-microservices-spring-cloud-config_null&amp;utm_source=jcg&amp;utm_medium=cpc\">Better, Faster, Lighter Java with Java 12 and JHipster 6<\/a><\/li>\n<\/ul>\n<p>Please follow us&nbsp;<a href=\"https:\/\/twitter.com\/oktadev\">on Twitter @oktadev<\/a>&nbsp;and subscribe to&nbsp;<a href=\"https:\/\/www.youtube.com\/c\/oktadev\">our YouTube channel<\/a>&nbsp;for more Spring and Spring Security tips.<\/p>\n<p><a href=\"https:\/\/developer.okta.com\/blog\/2019\/05\/23\/java-microservices-spring-cloud-config?utm_campaign=text_website_all_multiple_dev_dev_java-microservices-spring-cloud-config_null&amp;utm_source=jcg&amp;utm_medium=cpc\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">&#8220;Java Microservices with Spring Cloud Config and JHipster&#8221;<\/a>\u00a0was originally published on the Okta developer blog on May 23 2019<\/p>\n<p><span style=\"font-size: 20px;\"><b>Friends don\u2019t let friends write user auth. Tired of managing your own users?<\/b>  <a href=\"https:\/\/developer.okta.com\/signup\/?utm_campaign=text_website_all_multiple_dev_dev_java-microservices-spring-cloud-config_null&amp;utm_source=jcg&amp;utm_medium=cpc\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Try Okta\u2019s API and Java SDKs today. Authenticate, manage, and secure users in any application within minutes.<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Friends don\u2019t let friends write user auth. Tired of managing your own users? Try Okta\u2019s API and Java SDKs today. Authenticate, manage, and secure users in any application within minutes. Developing a microservice architecture with Java and Spring Boot is quite popular these days. It\u2019s definitely one of the most popular combinations in the Java &hellip;<\/p>\n","protected":false},"author":13127,"featured_media":240,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[1394,30,854,992],"class_list":["post-93990","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-jhipster","tag-spring","tag-spring-boot","tag-spring-cloud"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Java Microservices with Spring Cloud Config and JHipster - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Interested to learn about Java Microservices? Check our article explaining how to develop Java Microservices with Spring Cloud Config and JHipster.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/developer.okta.com\/blog\/2019\/05\/23\/java-microservices-spring-cloud-config\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java Microservices with Spring Cloud Config and JHipster - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Interested to learn about Java Microservices? Check our article explaining how to develop Java Microservices with Spring Cloud Config and JHipster.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/developer.okta.com\/blog\/2019\/05\/23\/java-microservices-spring-cloud-config\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2019-07-08T08:38:18+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-07-15T06:34:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Matt Raible\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@mraible\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Matt Raible\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"14 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/developer.okta.com\\\/blog\\\/2019\\\/05\\\/23\\\/java-microservices-spring-cloud-config#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/07\\\/java-microservices-spring-cloud-config-jhipster.html\"},\"author\":{\"name\":\"Matt Raible\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/54edd49deb980d7706e2af51514c3f7f\"},\"headline\":\"Java Microservices with Spring Cloud Config and JHipster\",\"datePublished\":\"2019-07-08T08:38:18+00:00\",\"dateModified\":\"2019-07-15T06:34:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/07\\\/java-microservices-spring-cloud-config-jhipster.html\"},\"wordCount\":2075,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/developer.okta.com\\\/blog\\\/2019\\\/05\\\/23\\\/java-microservices-spring-cloud-config#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"keywords\":[\"jHipster\",\"Spring\",\"Spring Boot\",\"Spring Cloud\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/developer.okta.com\\\/blog\\\/2019\\\/05\\\/23\\\/java-microservices-spring-cloud-config#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/07\\\/java-microservices-spring-cloud-config-jhipster.html\",\"url\":\"https:\\\/\\\/developer.okta.com\\\/blog\\\/2019\\\/05\\\/23\\\/java-microservices-spring-cloud-config\",\"name\":\"Java Microservices with Spring Cloud Config and JHipster - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/developer.okta.com\\\/blog\\\/2019\\\/05\\\/23\\\/java-microservices-spring-cloud-config#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/developer.okta.com\\\/blog\\\/2019\\\/05\\\/23\\\/java-microservices-spring-cloud-config#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"datePublished\":\"2019-07-08T08:38:18+00:00\",\"dateModified\":\"2019-07-15T06:34:52+00:00\",\"description\":\"Interested to learn about Java Microservices? Check our article explaining how to develop Java Microservices with Spring Cloud Config and JHipster.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/developer.okta.com\\\/blog\\\/2019\\\/05\\\/23\\\/java-microservices-spring-cloud-config#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/developer.okta.com\\\/blog\\\/2019\\\/05\\\/23\\\/java-microservices-spring-cloud-config\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/developer.okta.com\\\/blog\\\/2019\\\/05\\\/23\\\/java-microservices-spring-cloud-config#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"spring-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/developer.okta.com\\\/blog\\\/2019\\\/05\\\/23\\\/java-microservices-spring-cloud-config#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Java Microservices with Spring Cloud Config and JHipster\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/54edd49deb980d7706e2af51514c3f7f\",\"name\":\"Matt Raible\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/753d82443e50aed1ed2746573af191fe3e45c277ff3bd29873012a1b614355a7?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/753d82443e50aed1ed2746573af191fe3e45c277ff3bd29873012a1b614355a7?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/753d82443e50aed1ed2746573af191fe3e45c277ff3bd29873012a1b614355a7?s=96&d=mm&r=g\",\"caption\":\"Matt Raible\"},\"description\":\"Java Champion and Developer Advocate @okta with a passion for skiing, mtn biking, VWs, &amp; good beer.\",\"sameAs\":[\"https:\\\/\\\/developer.okta.com\",\"https:\\\/\\\/x.com\\\/mraible\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/matt-raible\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java Microservices with Spring Cloud Config and JHipster - Java Code Geeks","description":"Interested to learn about Java Microservices? Check our article explaining how to develop Java Microservices with Spring Cloud Config and JHipster.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/developer.okta.com\/blog\/2019\/05\/23\/java-microservices-spring-cloud-config","og_locale":"en_US","og_type":"article","og_title":"Java Microservices with Spring Cloud Config and JHipster - Java Code Geeks","og_description":"Interested to learn about Java Microservices? Check our article explaining how to develop Java Microservices with Spring Cloud Config and JHipster.","og_url":"https:\/\/developer.okta.com\/blog\/2019\/05\/23\/java-microservices-spring-cloud-config","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2019-07-08T08:38:18+00:00","article_modified_time":"2019-07-15T06:34:52+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","type":"image\/jpeg"}],"author":"Matt Raible","twitter_card":"summary_large_image","twitter_creator":"@mraible","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Matt Raible","Est. reading time":"14 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/developer.okta.com\/blog\/2019\/05\/23\/java-microservices-spring-cloud-config#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/07\/java-microservices-spring-cloud-config-jhipster.html"},"author":{"name":"Matt Raible","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/54edd49deb980d7706e2af51514c3f7f"},"headline":"Java Microservices with Spring Cloud Config and JHipster","datePublished":"2019-07-08T08:38:18+00:00","dateModified":"2019-07-15T06:34:52+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/07\/java-microservices-spring-cloud-config-jhipster.html"},"wordCount":2075,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/developer.okta.com\/blog\/2019\/05\/23\/java-microservices-spring-cloud-config#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","keywords":["jHipster","Spring","Spring Boot","Spring Cloud"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/developer.okta.com\/blog\/2019\/05\/23\/java-microservices-spring-cloud-config#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2019\/07\/java-microservices-spring-cloud-config-jhipster.html","url":"https:\/\/developer.okta.com\/blog\/2019\/05\/23\/java-microservices-spring-cloud-config","name":"Java Microservices with Spring Cloud Config and JHipster - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/developer.okta.com\/blog\/2019\/05\/23\/java-microservices-spring-cloud-config#primaryimage"},"image":{"@id":"https:\/\/developer.okta.com\/blog\/2019\/05\/23\/java-microservices-spring-cloud-config#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","datePublished":"2019-07-08T08:38:18+00:00","dateModified":"2019-07-15T06:34:52+00:00","description":"Interested to learn about Java Microservices? Check our article explaining how to develop Java Microservices with Spring Cloud Config and JHipster.","breadcrumb":{"@id":"https:\/\/developer.okta.com\/blog\/2019\/05\/23\/java-microservices-spring-cloud-config#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/developer.okta.com\/blog\/2019\/05\/23\/java-microservices-spring-cloud-config"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/developer.okta.com\/blog\/2019\/05\/23\/java-microservices-spring-cloud-config#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","width":150,"height":150,"caption":"spring-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/developer.okta.com\/blog\/2019\/05\/23\/java-microservices-spring-cloud-config#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Java Microservices with Spring Cloud Config and JHipster"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/54edd49deb980d7706e2af51514c3f7f","name":"Matt Raible","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/753d82443e50aed1ed2746573af191fe3e45c277ff3bd29873012a1b614355a7?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/753d82443e50aed1ed2746573af191fe3e45c277ff3bd29873012a1b614355a7?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/753d82443e50aed1ed2746573af191fe3e45c277ff3bd29873012a1b614355a7?s=96&d=mm&r=g","caption":"Matt Raible"},"description":"Java Champion and Developer Advocate @okta with a passion for skiing, mtn biking, VWs, &amp; good beer.","sameAs":["https:\/\/developer.okta.com","https:\/\/x.com\/mraible"],"url":"https:\/\/www.javacodegeeks.com\/author\/matt-raible"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/93990","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/13127"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=93990"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/93990\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/240"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=93990"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=93990"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=93990"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}