It seems that nowadays most of sample codes provided by https://spring.io/blog are all done with Spring Boot, so this post would show you how to write a standalone application with Spring and without Spring Boot.
STEP 1 : Add spring-context to pom.xml
STEP 2 : Create a class which has a "main" method so that you can run the jar with this class
STEP 3 : Define a class "AppConfig" for your application configuration
STEP 4 : Define your service class
STEP 5 : run "mvn clean install" and unzip the tar.gz file
STEP 6 : run the standalone java application with below
Option 1 (OS independent) : java -jar spring-way-standalone-1.0.0.jar
Option 2 (UNIX) : nohup java -jar spring-way-standalone-1.0.0.jar > /dev/null 2>&1 &
You may refer to the project source code here : https://github.com/junjun-dachi/spring-util
JOB DONE.
No comments:
Post a Comment