Spring with spring.config.location - spring

I am trying to point at path to external configuration file like this:
--spring.config.location=file: C:/Users/some_user/workspace/repository1/payment-api/payment.yml
and it doesn't work. Any idea why?

The proper prefix is file://. On Windows you need an extra "/" in the file URL if it is absolute with a drive prefix
Try file:///C:/Users/some_user/workspace/repository1/payment-api/payment.yml instead.

Related

Viper AddConfigPath only finding file in current folder "."

Have code that looks like
viper.AddConfigPath(".")
viper.AddConfigPath("$HOME/.config/myprogram")
viper.AddConfigPath("$HOME/configs")
viper.SetConfigFile("myprogram.yaml")
If I place myprogram.yaml in the current folder it works. However if I try putting it on either
$HOME/.config/myprogram$HOME/configs
The yaml file is not found. Any ideas or suggestions?
From the viper docs:
SetConfigFile explicitly defines the path, name and extension of the
config file. Viper will use this and not check any of the config
paths.
So if you use SetConfigFile the paths will be ignored. Try (as per the example):
viper.SetConfigName("myprogram")
viper.SetConfigType("yaml")
viper.AddConfigPath(".")
viper.AddConfigPath("$HOME/configs")
viper.AddConfigPath("$HOME/.config/myprogram")

How to store file with an absolute path?

How can I store a file with the absolute path /var/www/cityscape/public/storage/img/newyork.jpg?
I tried Storage::put() (https://laravel.com/docs/5.3/filesystem#storing-files), but this method seems to only accept relative paths.
If the path you've specified in your question is in the same system as your app you can use File instead:
File::put('/var/www/cityscape/public/storage/img/newyork.jpg', $theFile);
Hope this helps!

Fail to Download File Using Jmeter

http://blazemeter.com/blog/how-performance-test-upload-and-download-scenarios-apache-jmeter
I've used above link for reference.
I'm Using Save Responses to a file with Download call.
But fail to Download file.
Can anyone tell me What Exactly i need Specify in
FileName Prefix:
Variable name :
and where to Specify download location ?
Provide absolute file path with a file name.
FileName Prefix: c:\workspace\jmeter-download\myfile
For ex: If your test is downloading a pdf file, you would see a 'myfile.pdf' under 'c:\workspace\jmeter-download'
I've used path like D:/xyzFolder/filename as Filename Prifix
it's working fine for me
and if any one wants file to download in same Dir in which your jmx file is
then just need to use ~/pre as Filename Prifix

How do I get the directory where the executable is located?

I got the filename like this:
_TCHAR filename[_MAX_PATH];
GetModuleFileName(NULL,filename,sizeof(filename));
How do I remove the filename from this full path? Should I use regex?
You can use the Windows shell API function PathRemoveFileSpec to do this. Example usage is listed on the linked page.
Since you use VS++, you can use:
_splitpath and _wsplitpath functions to break apart path

log4j.properties value filter

Hi:
I am using log4f for the logging in my app,and I want to add a FileAppender to the log,so I have to set the file:
log4j.appender.fileout.File=E:\myapp\logs\log.html
I wonder if there is any way can replace the absolute file path?
Maybe using something like:
log4j.appender.fileout.File={something}\logs\log.html?
Sure it's possible:
log4j.appender.fileout.File=./logs/log.html
Where E:\myapp is your application path.

Resources