Reputation: 25790
I have a following property declared at my Spring Boot/Maven project:
@Value("${download.folder.path}")
private String downloadFolderPath;
where download.folder.path
is a property declared at my application.properties
file and at Maven profile.
Right now the property value is something like this:
<download.folder.path>d:/somedir</download.folder.path>
Everything works fine but I want to point download.folder.path
property to default system temp folder for my tests instead of providing a real path.
Is it possible with Spring/Maven configuration?
Upvotes: 1
Views: 10219
Reputation: 555
1.)Writing below in SpringBoot main class for whole application to be working :
System.setProperty("java.io.tmpdir", "C:\\Users\\abcde\\Desktop\\Temp");
2.)While Running JUnit in Spring Boot application , I have set -Djava.io.tmpdir=C:\Work\TEMP in VM Arguments and it worked for me .
Upvotes: 0
Reputation: 57381
Use reference to java tmp dir property (check System.getProperty("java.io.tmpdir")) and reference the property like this
<download.folder.path>{java.io.tmpdir}</download.folder.path>
See the reference properties here
Upvotes: 3
Reputation: 3638
If you are using Spring Boot, check out @TestPropertySource
.
You should be able to use that to point to /tmp
or wherever.
Upvotes: 0