Skip to content

Tag: properties

Spring value injection in mockito

I’m trying to write test class for the following method I’m using the injected url value in one of the methods in the class. To test this i’ve written a junit class In applicationContext-test.xml I’m loading the property file using But the url value is not getting loaded in the CustomS…

Java Properties backslash

I am using Java Properties to read a properties file. Everything is working fine, but Properties silently drops the backslashes. (i.e.) How do I make Properties not do this? I am using the code prop.getProperty(key) I am getting the properties from a file, and I want to avoid adding double backslashes Answer …

Saving to properties file escapes :

Does anyone know why the colons are getting escaped when I store the properties file? I’m doing this: And storing using: It’s working but the output has colons escaped for some reason: Anyone know a fix? Answer In properties files, both of these are legit: So both = and : must be escaped. Now, if …