在独立应用程序中使用Spring [英] Using Spring in a standalone application

查看:96
本文介绍了在独立应用程序中使用Spring的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找在独立(桌面/摇摆)应用程序中使用 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.

推荐答案


  1. 创建与maven一起使用独立应用程序,如下所示:

  1. Create the standalone application with maven, as pointed here:

使用Maven创建一个独立的应用程序

将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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆