As short, sweet and simple an example as I could come up with to show a functioning Spring program with Java Annotation based configuration.
Java
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.idea
src/main/java/com/oopuniversity/injectiondemo
README.md
SpringJavaConfigDemo.iml
pom.xml

README.md

SpringJavaConfigDemo

As short, sweet and simple an example as I could come up with to show a functioning Spring program with Java Annotation based configuration. I believe this is the most concise possible automatically configured and injected Spring program possible as of June 5, 2016

There are no configuration XML files, no configuration Java files, nothing but a properly written main application and a couple of automatically instantiated objects, with one being injected into the other.

It also has the feature that you can select which of two implementation packages you wish to use at run time. You can do that from the command line by specifying the package name as an argument to the program.

It took me longer than I thought it should have to figure this out, and now that I look at what's actually involved I feel rather stupid for having had it take so long. In my defense, searching out information on this via web searches is a lengthy process of finding and ruling out the old, the obsolete, the misguided and the just plain wrong.

I hope this example helps someone else to avoid that pain.