-
May 31st, 2006, 11:46 AM
#1
Creating a ClassPathXmlApplicationContext
I currently have a configuration file located in my classpath (C:/blah/blah/blah/spring.xml).
I am trying to create an ApplicationContext using the ClassPathXmlApplicationContext in the following manner:
Applicationcontext ctx = new ClassPathXmlApplicationContext("spring.xml");
object = (object) ctx.getBean("MyService_MyAction");
I continued to get an IOException "cannot be opened because it does not exist".
After this, I modified the ClassPathXmlApplicationContext to use ("classpath*:spring.xml"). There is no IOException, but it is unable to create the bean:
"NoSuchBeanDefinitionException: No Bean named 'MyService_MyAction' is defined.
I have been able to load this spring.xml file and bean using the FileSysttemXmlApplicationContext, but I would like to have some more flexibility on where the spring config resides. Are there other options?
Any help on this would be much appreciated.
Thanks!
Will
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules