Hello,
I'm trying to read a css file with the Resources provided by Spring.
My application looks like this:
- src
- src/com herer my classes inside packages
- WebContent
- WebContent/resources/style/myCSS.css --> the css I want to read
- WebContent/WEB-INF --> here is my application-context.xml
I can get the css and read it by doing something like this:
UrlResource file = new UrlResource("http://localhost:8080/myApp/resources/style/myCSS.css");
but it depends on the server and aplication names. I've tried to do it by other implementations of Resource Interface, but the file is not found cause I can't find out how to wite the path. I've tried with this:
FileSystemResource file = new FileSystemResource("/WebContent/resources/style/myCSS.css");
I also tried with wildcards, but it doesn't find the file either.
ApplicationContext ctx = new FileSystemXmlApplicationContext("classpath*:/WEB-INF/application-context-core.xml");
Resource file = ctx.getResource("file:**/myCSS.css");
How should I write the path to get the css.
Thanks.