create simple spring application, deploy spring web app in tomcat, how to deploy application in tomcat, Spring Framework, spring MVC sample, spring web application, WAR file format (Sun), Web application
How much time will it take to create a spring based web application and build it as a war and deploy it to tomcat?.
Without spring suite IDE, the above task will be working with jsp, servlet, web.xml, spring config, ant script and tomcat. I am sure it will take more time when compared to the below steps.
By following the below steps, you can do it in less than 15 mins. The prerequisite is you must have spring suite IDE installed in your machine..:). You are NOT doing the below steps here.
1. any coding work
2. writing build script for war file
3. adding classpath entries
4. separate consoles and any manual works.
Everything is integrated here. The first 5 clicks make an web application. Isn’t it easy?
Your Steps Begins Here:
1. Open the spring IDE. Once opened, it will show you the dashboard page.
2. Select Spring Template Project from the dashboard.
3. You will get template selection screen. Choose Spring MVC Project and then click ‘next’.
4. Enter the project name and the package structure you want.
5. That’s it. Your project is created with maven structure. To know more about maven structure, please visit Maven tutorials. Your project structure will be like below.
6. To deploy it in tomcat, it is much easier than creating the above web application. Spring suite itself has a server (VFabric) built over the tomcat. Choose servers from your spring IDE.
7. Right click on the server. Click add and remove.
8. It will show you the list of projects in your workspace. Select the SpringSample project and click add to configure it in tomcat.
9. Right click your pom.xml and choose maven clean ( to clean the workspace). Once done, click on maven package.( it builds your war file).
10. Before starting your server, we need to ensure that the maven build includes the dependencies in web-inf/lib of your project. If not you need to include else you get class not found exception. To do that Right click your project and select Maven –> Enable Dependency Management.
11. Once again, right click the project and go to properties. Check whether maven dependencies added in Deployment Assembly.
12. Now start/restart your server. Your application has deployed now in tomcat.
13. Goto http://localhost:8080/SpringSample to launch your web app.
That’s it. You can build your components on this sample app.