I read a post on TheServerSide.com by some handsome fellow that talked about getting rid of XML files, and that's exactly what I'm trying to do. I don't want any XML files in my Spring application. I spit on XML. Pffth!!!
So, without any XML files, there's nowhere to put <context:annotation-config/>
I was having problems, and I was reading a post that described how to do this in Spring 2.5. It used the following two annotations together:
However, when you create your beanFactory, or context, in Spring 3.0, you don't need the @AnnotationDrivenConfig. What you do instead is create an AnnotationConfigApplicationContext object, which acts as your beanFactory:
By the way, I now refer to this AnnotationConfigApplicationContext class simply as ACAC. It's much easier to write out.
It appears that this class is by default, capable of doing autowiring. You then just get your beans from this context as you normally would:
My SimpleConfig class is simply a POJO annotated with @Configuration
And the autowiring now works in the GameService, which is loaded up from the ACAC.
The problem was I had the @Autowired originally on the constructor, which would not work. I can put the @Autowired on the setter, or on the property itself, and all is fine, but it won't work on the constructor:
AUTOWIRING THE SETTER WORKS:
AUTOWIRING THE CONSTRUCTOR DOES NOT WORK
I'm still not sure of the rationale for allowing setters to be autowired but not constructors?