Because of service-oriented architecture style, instead of a monolithic application , you may have several independent applications can run on their own.Let's see how to have a Spring powered standalone application with embedded Tomcat without Spring boot.
Step 1 : Add Related Dependencies to POM
Step 2 : Define A Class Which Would Create , Start and Stop Tomcat Server
Step 3 : Define Class Which Would Launch The Application and Initialize The Embedded Tomcat Server.
Step 4 : Define Web Application Initializer And Enable Spring MVC Configuration
Step 5 : Define Controller and Service Layer
Step 6: Define Web Page
Step 7 : Run Class ApplicationLauncher and Check Web Page at http://localhost:6060/echo
Step 8 : Or "java -jar embedded-tomcat-with-spring-1.0.0.jar" from embedded-tomcat-with-spring-1.0.0.tar.gz by "mvn clean install"
You may refer to source code here :
https://github.com/junjun-dachi/spring-util/tree/master/embedded-tomcat-with-spring
JOB DONE
great
ReplyDeleteHii,
ReplyDeleteI am trying to develop a standalone rest api with embedded tomcat in the same manner you are doing, only difference is that I have a restcontroller with no jsp to render the output. I want to invoke a api on controller and it should return the output as a json or a string. How to bypass the model and view here.
Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
ReplyDeleteSalesforce Training in Chennai | Certification | Online Course | Salesforce Training in Bangalore | Certification | Online Course | Salesforce Training in Hyderabad | Certification | Online Course | Salesforce Training in Pune | Certification | Online Course | Salesforce Certification Online Training Courses
I appreciate that you produced this wonderful article to help us get more knowledge about this topic.
ReplyDeleteI know, it is not an easy task to write such a big article in one day, I've tried that and I've failed. But, here you are, trying the big task and finishing it off and getting good comments and ratings. That is one hell of a job done!
angular js training in chennai
angular js training in omr
full stack training in chennai
full stack training in omr
php training in chennai
php training in omr
photoshop training in chennai
photoshop training in omr
Thanks for any other wonderful post. Where else may just anyone get that type of info in such a perfect means of writing? I’ve a presentation next week, and I am on the look for such information.
ReplyDeletesap training in chennai
sap training in velachery
azure training in chennai
azure training in velachery
cyber security course in chennai
cyber security course in velachery
ethical hacking course in chennai
ethical hacking course in velachery
Hi. Here you are pretending the 'EmbededServer' as a Spring component (therefore as a part of application context). Is it possible to run the embedded tomcat server separately from Spring application context but still use the Spring DispatcherServlet?
ReplyDelete