Yes, Spring is like a Swiss Knife in the sense that it's a multi-function tool, except that just being a bunch of knives, it's more or less like a drill, a jackhammer, a chain saw, and a loofah rolled into one. WHen you first look at it, you go "Wha?? What do I do with this. How do I hold it" . But, when you get used to it, you wonder how did you even live your life without it. You can do everything without Spring. Spring just makes it easier. And if Spring doesn't do it, you can easily make it easier by extending Spring.
Learning it is difficult though. 5 years ago when I first encountered Dependency Injection, I made a post that went "DI! how does it work?" There was a book promo going on at the time, and we had a guest author (not of a Spring book) and he very politely told me to get a book. I feel your pain. I really do
I would recommend that
a) learn Spring core before you learn any of the Spring libraries. A lot of Spring's power and magic comes from DI, IoC and AOP. You need to understand that first. The magic has grown a lot in the past 6 years, and unless you don;t understand core well, it might all seem greek to you
b) Don't dive into learning a Spring library before you understand core. THe core makes a lot of things magic, and unless you don;t understand the magic, it confounds you
c) Don't expect to get coding by looking at tutorials. Tutorials help once you understand what's going on. The problem is once you run into problems you can;t fix them because you don;t understand what's going on
d) I completely recommend Spring In Action. It starts with Core. I haven't read Pro Spring, but from the TOC, it seems like a good book
Now, to your specific issue. How are you executing the main function? Is it through command line or through the
IDE? It sounds to me like Spring is on compile time class path, but it's not on runtime classpath. Just a hunch. What does the book say about running the app? I think if the book is specific about how to run the sample, then
you should follow it just so you can focus on learning Spring rather than struggling with classpath issues
Personally, I like to run sample code inside
JUnit. Especially because Maven has good support for JUnit, and it handles setting up the runtime class path for you. I would suggest that you follow the book's instructions, but if the book is not specific, put the sample code in JUnit. Maven will make it easy for you.