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.
Spring Boot makes it easy to create stand-alone, production-grade Spring-based applications. Spring Boot provides various starters for building standalone or more traditional war deployments.
Spring is a popular Java application framework. It provides various libraries and tools for enterprise application programming. It is also a very good integration system that helps glue together various enterprise components. Spring ApplicationContext is a central interface to provide configuration for an application.
With Spring, you can build production-ready spring applications. Mostly, Spring Boot is used for web applications, however, it has many capabilities to be a perfect fit for your desktop application.
Create the standalone application with maven, as pointed here:
Create a standalone application with Maven
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With