Finding a property using Spring and Webapp properties placeholder?

This should work WEB-INF is not the root of the of the web-app, so you need to add WEB-INF to the path. Spring-context-3.1.xsd.

Thank you sooo much! – thelonesquirrely Jun 24 at 20:04 You are welcome. Glad to see it helped.

– Jeesmon Jun 24 at 20:12.

You can't do it the way you want since the classpath for the Classloader will be the /classes directory and any jars in the /lib directory. This is the standard configuration for a war file. Wars and ears have specific configurations which you have to follow for the files to be valid.

If you think about it, it would make it difficult to have different vendors provide web containers that could deploy the same war file if there was no standard format. There is a pretty informative page here. To achieve something similar to what you want, you can simply have directories of /classes/properties and /classes/spring and look them up appropriately from your classpath ("classpath:properties/myfile.

Properties).

I thought that the preferred location for the spring files was in WEB-INF/spring/. I can't remember where I read that at - but you set it in the web. Xml file.

– thelonesquirrely Jun 24 at 19:26 I think the directory is 'spring' before you build but once a WAR is generated, it all ends up in 'classes' so that it ends up on the class path. It may not be your desire but the WAR structure is standardized already; you shouldn't be trying to customize it. – Jesse Webb Jun 24 at 19:45 I will leave the properties files alone then :).

As an aside - the spring files are not copied into the classes folder. Take a look at the petshop link. It is built by Maven which copies the WEB-INF directly and then copies src/main/resources to WEB-INF/classes/ and the properties usually live in src/main/resources – thelonesquirrely Jun 24 at 20:01.

I am not sure what you want to achieve. Here the method I use to inject the properties from a basic properties file to a bean: In the spring files (XML bean definitions), I add the reference to my property file (myfile. Properties): and then I add my references to the properties (db.

Url is the URL address for my database connection, I kept only the bean properties referenced in my property file). ${db. Url} ${db.

Login} ${db. Password} By default, if the property is not defined in the property file, Spring uses the System Properties (this behaviour can be changed).

I am fine with accessing the properties - it is where I want the files to live. Instead of in WEB-INF/classes/properties/*. Properties I'd rather have WEB-INF/properties/*.

Properties – thelonesquirrely Jun 24 at 19:16.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions