在独立应用程序中使用Spring [英] Using Spring in a standalone application
问题描述
我正在寻找在独立(桌面/摇摆)应用程序中使用 Spring 的示例或教程,我搜索了很多但无法获得有用的东西,所有示例和教程都是针对Web应用程序的,请指教。
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.
推荐答案
-
创建与maven一起使用独立应用程序,如下所示:
Create the standalone application with maven, as pointed here:
将applicationContext放在类路径中,并将其加载到主类如下:
Put the applicationContext in classpath, and load it in the main class as follows:
ClassPathXmlApplicationContext ctx =
new ClassPathXmlApplicationContext("applicationContext.xml");
请参阅此处的完整文章:
See full article here:
< a href =http://www.devdaily.com/blog/post/java/load-spring-application-context-file-java-swing-application =noreferrer> http://www.devdaily。 com / blog / post / java / load-spring-application-context-file-java-swing-application
这篇关于在独立应用程序中使用Spring的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!