Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Support simplified main class application context / dependency management [SPR-9044] #13684
One common request I see quite frequently on the internet is the ability to have spring autowire a main class:
There is no shortage of questions / solutions to this problem which illustrates a need for a standardized approach.
What I am proposing is combination of features between the following existing classes:
Thus provinding first class support for console based application context management and DI.
My visions is something like the following:
The way this would work is as follows:
4 votes, 10 watchers
Bob Tiernay commented
As a further simplification / enhancement,
In the above there are a few things to note:
Dave Syer commented
There's a lot of nice stuff here. There's also a duplicate at #12732.
I wonder if there's really any need to write a main() method at all as a Spring user though - these days it makes a lot more sense to put all app specific java code in an
Phil Webb commented
Rather than fix this as part of the core Spring Framework we have decided to start a new project called Spring Boot that addresses this and a number of other issues.