-
Jun 30th, 2010, 09:18 AM
#1
Main class.
Hi, I used spring once about a year ago and I've completely forgotten how I setup my main class.
I recall that with spring I was able to have a Main(){} that didn't have a static main method, and that this was somehow handled by spring. Is this possible? If so, how was it done.
Thanks
-
Jun 30th, 2010, 11:18 AM
#2
If you're writing a standalone Java class that you intend to run from the command line, you can't avoid the requirement of a "public static void main(String[] args)" method. This has nothing to do with Spring. Your "main" method will likely construct an instance of "ClassPathXmlApplicationContext".
I suggest you read the Spring Reference Documentation and/or examine the numerous "Spring hello world" tutorials on the internet.
-
Jun 30th, 2010, 12:12 PM
#3
So there's no situation where I can have a main without being static., ok that's fine I must be mistaken.
and yes I have looked at the hello world tutorials, they all have static main, hence I'm here asking.
-
Jan 21st, 2012, 10:01 AM
#4
In order to simplify main setup I have created https://jira.springsource.org/browse/SPR-9044. If you like the proposed approach, please vote for it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules