== Setting up the sample

This section outlines how to setup a workspace within STS so that you can follow along with this guide. The next section outlines generic steps for how to apply Spring Security to your existing application. While you could simply apply the steps to your existing application, we encourage you to follow along with this guide as is to reduce the complexity.

=== Obtaining the sample projects

There are multiple ways in which you can obtain the source. We have highlighted a few ways below:

* <<downloading-from-github>>
* <<cloning-from-github>>

==== Downloading from github

You can download the source from github.

* https://github.com/SpringSource/spring-security/archive/master.zip[Development Version]
* https://github.com/SpringSource/spring-security/releases[Released Versions]

Extract the zip to a known location and remember it as _SPRING_SECURITY_HOME_. You are now ready to <<import-the-{starter-appname}-sample-application>>

==== Cloning from github

If you wish you can also obtain the source by cloning from github. For example, if you have a git client installed you can type the following:

----
cd ~/git/
git clone https://github.com/SpringSource/spring-security.git
----

In this example, the code will be placed at "~/git/spring-security". Remember this location as  _SPRING_SECURITY_HOME_.

=== Import the {starter-appname} sample application

In oder to follow along, we encourage you to import the {starter-appname} sample application into your IDE. You may use any IDE you prefer, but the instructions in the guide will assume you are using Spring Tool Suite (STS).

TIP: The completed sample application can be found at _SPRING_SECURITY_HOME_/{completed-appname}

* If you do not have STS installed, download STS from http://www.springsource.org/spring-tool-suite-download For performance reasons, we prefer the release based on Eclipse Juno.
* Start STS and import the sample applications into STS using the following steps:
** *File->Import*
** *Existing Maven Projects*
** Click *Next >*
** Click *Browse...*
** Navigate to the samples (i.e. _SPRING_SECURITY_HOME_/samples/{starter-appname}) and click *OK*
** Click *Finish*

=== Running the {starter-appname} application

In the following exerecise we will be modifying the _spring-security-samples-{starter-appname}_  application. Before we make any changes, it is best to verify that the sample works properly. Perform the following steps to ensure that _spring-security-samples-{starter-appname}_  works.

* Right click on the _spring-security-samples-{starter-appname}_ application
* Select *Run As->Run on Server*
* Select the latest tc Server (i.e. v2.9)
* Click *Finish*

include::{verify-starter-app-include}[]

Once you have verified the application runs, stop the application server using the following steps:

* In the Servers view select the latest tc Server
* Click the stop button (a red square) to stop the application server
