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

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"

Related

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

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?

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 ?

Spring Boot Gradle - avoid lib-provided folder in war file

I have a Spring Boot based application and I'm trying to switch over from Maven to Gradle. The application is supposed to build a war file, which is deployed to a web server (WildFly in our case).
Now, I have some libraries provided by the web server and thus using a "providedCompile" scope (For hibernate search and infinispan). Now, when used with Spring Boot plugin, the plugin is creating the war file with all the "providedCompile" libraries moved to a folder named "lib-provided".
How do I avoid this? On the same context, it is also adding the Spring Boot loader classes on to the war file. If possible, I need to avoid this too.
Please help! Thanks!
If you're only ever going to deploy your application as a WAR file to an app server, then you don't need it to be turned into an executable archive. You can disable this repackaging in your build.gradle file:
bootRepackage {
enabled = false
}

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

When using Spring + Spring Boot + STS, where in the Spring Project directory is the localhost "home" folder?

I am using Spring/Spring Boot/and Ember. I want to put my index.html file in the "localhost" main folder, but I have no idea how the Spring Tool Suite deploys Spring Boot. What is the normal process for HTML development and accessing a Spring REST server without getting Cross Site Scripting errors?
My folder structure is as follows:
/.settings
/BookingClient
/gradle
/html (this is where my index.html, css, and all Ember related JS stuff is)
/node_modules
/src
/target
I am guessing its somewhere in the /target directory but nothing I have tried has worked.
Spring Boot will serve static resources for you. Simply put them in src/main/resources/static. See the documentation on static content for more information.

Resources