Hi everybody,
I am having a problem on using ClassPathResource.
I defined my resource as a bean
Then I wired it up with my mail client classCode:<bean id="welcome_mail_template" class="org.....ClassPathResource"> <constructor-arg value="classpath:mails/welcome.txt" /> </bean>
but when i try to call the getFile() method on my resource from within the MailClient, it throws an IOException. The code that throws the exception is:Code:<bean id="mail_client" class="it......MailClient"> <property name="welcomeMail" ref="welcome_mail_template" /> </bean>
where getWelcomeMail() is the getter to obtain the resource (that is declared as interface Resource)Code:File f = this.getWelcomeMail().getFile();
The exception is a FileNoutFoundException, the message is "class path resource [classpath:mails/welcome.html] cannot be resolved to URL because it does not exist", but I have yet check more than once and paths and names seem to be correct.
Can anybody help me? What am I doing wrong?
--Stefano


Reply With Quote