samedi 16 juillet 2016

Backslash () in .proprties file is being ignored by Spring's 'Environment' variable

I am trying to load a config.proprties file data in a Spring @Configuration java class using @PropertySource and Environment variable. Issue is, I have a property which has value like:

     serverName = abcxyz

When I read this property by using method,

     String server= env.getProprty("serverName");
     System.out.print(server);

Value is printed as "abcxyz".

Please note that, I tried using double backslash like,

     serverName = abc\xyz

but still it is simply ignoring from the value string. Also I can not use forward slash in place of backslash.

Can you help me in fixing it? Thanks in advance!!

Aucun commentaire:

Enregistrer un commentaire