Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
187 views
in Technique[技术] by (71.8m points)

java - Using Spring in a standalone application

i am looking for samples or tutorials of using Spring in a standalone (desktop/swing) application, i searched a lot but couldn't get to something useful, all the examples and tutorials are for web applications, please advise.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
  1. Create the standalone application with maven, as pointed here:

    Create a standalone application with Maven

  2. Put the applicationContext in classpath, and load it in the main class as follows:

    ClassPathXmlApplicationContext ctx = 
            new ClassPathXmlApplicationContext("applicationContext.xml");
    

    See full article here:

    http://www.devdaily.com/blog/post/java/load-spring-application-context-file-java-swing-application


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...