• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
Bartenders:
  • Himai Minh
  • Carey Brown
  • Frits Walraven

PropertySources Empty in Spring Cloud Config

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Everyone,

I am trying to learn Spring Cloud Config because the application I work on is deployed on different servers with different properties. Previously it used Ant and filtering to create properties for each server at deployment time. But we are moving to Maven. So that option is gone. And moreover it was a very crude way of going about things. But then again, 15 years ago that was the only option they had I guess.

Okay that is the background. I have read some tutorials and gone through some of the code given there. I wrote a Spring Boot App that reads the property files, and I try to fetch it on the browser.

But the problem is, the properties show up empty. It is a very basic piece of code. So it not working has really dented my confidence!

My code is like this:




And my application.properties is like:



My pom.xml is:



But when I hit the URL:



I only see this:


Now I am not quite sure why the propertySource would be empty here. It should list the properties that I have in the properties file. The tutorials make it look easy. And the startup logs, dont shed any light on it. Although I do not know what to look for really!

I am on a Windows machine and running the code in Eclipse.

Now I have seen different tutorials have different property keys for the search locations, can you please tell me which one is right?


OR



I dont know what else information to provide, if you need anything else, please do let me know, I will add it to the question. Any help is greatly appreciated. Thanks!

 
Bartender
Posts: 2101
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Sam,
How about this ?


 
Sam Mallick
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unfortunately the result is the same. I still get an empty JSON.
 
Himai Minh
Bartender
Posts: 2101
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about this URL  localhost:9090/myProperties ?
You may find a tutorial about how to create Spring Cloud config server here:
https://www.javatpoint.com/connect-spring-cloud-config-server-to-local-git-repository
But the Spring boot version they are using is not the latest.
 
Sam Mallick
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My problem is the GIT thing. Probably with Git the code might just work out fine. But I am using a native profile and trying to read a properties file from a local file system.

And with that URL I get:
 
Himai Minh
Bartender
Posts: 2101
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure if the Spring security block the access to the local repository. You can experiment by removing the Spring security dependency and see.
 
What's that smell? I think this tiny ad may have stepped in something.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic