This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Spring and the fly likes re: basic question on Spring framework Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Spring
Reply Bookmark "re: basic question on Spring framework" Watch "re: basic question on Spring framework" New topic
Author

re: basic question on Spring framework

Mark Curlette
Greenhorn

Joined: May 26, 2011
Posts: 29

Hello,
I just try to learn the Spring framework , and I ran into an error message when I try to run a simple spring "helloWorld" application.
The error stated that "org.springframework.core.io.ClassPathResource cannot be cast to org.springframework.beans.factory.BeanFactory" which refer to this code in my program:



and the file SpringHelloWorld.xml is located in /Spring/src/SpringHelloWorld.xml

The complete program is as follow





Please help me if you know what's going wrong.

Thnaks so much in advance.

Mark
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17233
    
    1

Let me save you much time.

If you are learning Spring new, then you will never ever use that type of code. That is over 5 years old style of Spring coding. I recommend finding Spring materials that are up to date.

You will use a class that implements ApplicationContext instead.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Mark Curlette
Greenhorn

Joined: May 26, 2011
Posts: 29

Thank you so much Mark for showing me the right direction.

Yes, I followed your advice to get new text material on Spring , and changed my code to ApplicationContext and it worked wonderfully.




Thanks again and have a great day.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: re: basic question on Spring framework
 
Similar Threads
How to have multiple public classes in one file for spring?
Issue facing in the spring code
Issue with XMLBeanFactory
Not able to understant object initialisation
Using properties file for defining class dependency