How to get native query from spring cloud config server properties file - spring-boot

I have a requirement to keep the SQL queries outside source code.
I know I can keep the queries in jpa-named-queries.properties inside META-INF folder but can we load this from config server? Or is it need to be inside spring boot jar?

Related

How to access resources folder outside of the war in spring boot

I have a rest API written in Spring Boot that has to be deployed on a weblogic server on Unix. I have some property files and DRL files in src/resources folder. I want to place all these files on a Unix location and access them in my application. Is there a way to do this ?
When you want Spring to look outside the project folder you want:
"file:/Users/username/MyDirectory/file.txt"

Defining Database dynamically in spring boot maven based war application

My Spring boot application won't know the database to be connected in prior, once before application deployment, the user will select the database to be connected, and places the jar in the server webinf(or probably some other repository path), and changes the externalized properties file, so that application connects to the database, I was trying giving the database dependency scope as provided, but getting class not found. What is the preferred approach for solving the issue?
You can run your Spring Boot bootJar like this:
java -cp your-jdbc-driver.jar -jar your-boot-jar.jar --spring.datasource.url=your:jdbc:url

Springboot finds files in src/main/webapp but not src/main/webapp/anything

I'm using Sprint boot to run a web application. I did not configure any classes explicitly. I have a strange problem. When running the web server using gradle bootRun, I am able to access files that are directly under webapp folder but not a sub-folder like webapp/something.
I'm not posting any code here because there is nothing explicitly I configured different from a default spring boot web app. I'm using structure as in https://github.com/jhipster/jhipster-sample-app-gradle
Anyone faced this problem before ?

Can a Library jar read properties from Spring Cloud Config Server?

I have a shared Library that needs some properties from a .properties file. This shared Library will be used by a Spring Boot application. We already have a Spring Cloud Config server which is serving the properties to this Spring Boot application.
Now, we want the properties for the Library also to be fetched from the Config Server, rather than packaging it's properties file along with the library jar file.
Can I let my Library file pick-up properties from the Spring Cloud Config server ? The Spring Cloud Config server documentation states the following.. seeing it, looks like only a 'Spring Boot' application can talk to the Spring Cloud Config Server to fetch properties from there.
Any pointers or suggestions ?
can be used with any application running in any language
To use these features in an application, just build it as a Spring
Boot application that depends on spring-cloud-config-client
Ref: http://cloud.spring.io/spring-cloud-config/spring-cloud-config.html#_spring_cloud_config_client
No, a Library cannot talk to the Spring Cloud Config Server to get the properties file. Instead the config server should have those Library file's properties define din the using application's properties file.
Library: x.jar
Application: y.jar
Property file in Config Server: y.properties / y.yml
This property file will have the properties for classes present both in x.jar and in y.jar

Where can i store(keep) xml files of a java application inside the grails application

I am using spring batch processing code of a java application in my Grails application. I wanted to know where can i keep the xml files of a java application inside the grails application. How can i call that xml file from the grails application?
There is a special place for such config files:
grails-app/conf/
Put it here, and file will be accessible from classpath, as a root element

Resources