Book Image

Spring MVC: Beginner's Guide - Second Edition

By : Amuthan Ganeshan
Book Image

Spring MVC: Beginner's Guide - Second Edition

By: Amuthan Ganeshan

Overview of this book

Spring MVC helps you build flexible and loosely coupled web applications. The Spring MVC Framework is architected and designed in such a way that every piece of logic and functionality is highly configurable. Also, Spring can integrate effortlessly with other popular web frameworks such as Struts, WebWork, Java Server Faces, and Tapestry. The book progressively teaches you to configure the Spring development environment, architecture, controllers, libraries, and more before moving on to developing a full web application. It begins with an introduction to the Spring development environment and architecture so you're familiar with the know-hows. From here, we move on to controllers, views, validations, Spring Tag libraries, and more. Finally, we integrate it all together to develop a web application. You'll also get to grips with testing applications for reliability.
Table of Contents (20 chapters)
Spring MVC Beginner's Guide - Second Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

The Gradle build script for your project


To configure the Gradle build script for your project, perform the following steps:

  1. Go to the root directory of your project from the filesystem, create a file called build.gradle, and add the following content into the file and save it:

          apply plugin: 'war'
          apply plugin: 'eclipse-wtp'
          repositories {
                   mavenCentral() //add central maven repo to your buildfile
          }
    
          dependencies {
    
                  compile 'org.springframework:spring-webmvc:4.3.0.RELEASE',
    
                           'javax.servlet:jstl:1.2',
                           'org.springframework:spring-jdbc:4.3.0.RELEASE',
                           'org.hsqldb:hsqldb:2.3.2',
                           'commons-fileupload:commons-fileupload:1.2.2',
                           'org.apache.commons:commons-io:1.3.2',
                           'org.springframework:spring-oxm:4.3.0.RELEASE',
                           'org.codehaus.jackson:jackson-mapper-asl:1.9.10',
                           'com.fasterxml.jackson.core:jackson-databind:2.8.0',
                           'log4j:log4j:1.2.17',
                           'org.springframework.security:spring-security
                            -config:4.1.1.RELEASE',
                           'org.springframework.security:spring-security
                            -web:4.1.1.RELEASE',
                           'org.hibernate:hibernate-validator:5.2.4.Final',
                           'org.springframework.webflow:spring
                            -webflow:2.4.2.RELEASE',
                           'org.apache.tiles:tiles-extras:3.0.5'
    
                      providedCompile 'javax.servlet:javax.servlet-api:3.1.0'
    
                      testCompile 'junit:junit:4.12',
                                       'org.springframework:spring
                                        -test:4.3.0.RELEASE',
                                       'javax.servlet:jsp-api:2.0',
                                       'com.jayway.jsonpath:json-path
                                        -assert:2.2.0'
          }
  2. Now go to the root directory of your project from the command prompt and issue the following command:

          > gradle eclipse
    
  3. Next, open a new workspace in your STS, go to File | Import, select the Existing Projects into Workspace option from the tree list (you can find this option under the General node), and then click on the Next button.

  4. Click on the Browse button to select the root directory and locate your project directory. Click on OK and then on Finish.

Now, you will be able to see your project configured with the right dependencies in your STS.