Spring Book – Chapter 2 – Getting started with Spring

Quick tour of STS

SpringSource Tool Suite™ (STS) provides the best Eclipse-based development environment for building Spring-powered enterprise applications. It has pre-installed plugins that provides valuable features for Spring developers. STS supplies all the tools you need for developing with the latest enterprise Java, Spring, Groovy and Grails based technologies. Included with STS is the developer edition of vFabric tcServer, the drop-in replacement for Apache Tomcat that’s optimized for Spring. STS supports application targeting to local, virtual and cloud-based servers. It is freely available for development and internal business operations use with no time limits. The main plug-in for STS is Spring IDE, which provides the fundamental Spring tooling features required for your application. STS comes preconfigured with many other plugins such as M2Eclipse for Maven, Web Tools Platform (WTP), Data Tools Platform (DTP), and AspectJ Development Tools (AJDT) and JUnit tooling.

Why use SpringSource Tool Suite

Due to the following features below, you should use STS for developing Spring based applications:

  • Content aware XML Spring Bean editing and refactoring
  • Content-aware Spring shortcuts for Java classes
  • Graphical configuration editing
  • Validators for project configuration
  • Dashboard
  • Spring Insight and tcServer

Core support by STS

SpringSource Tool Suite gives certain core Spring support by default. These are given as bullet points below:

  • Graphical Spring configuration editor
  • Spring project, bean and XML file wizards
  • Spring application blue prints and best practice validation
  • Bean mapping visual editor

Other spring related technology support by STS

STS not only gives core Spring support, it also give other technology support as well. These are given as bullet points below:

  • Spring Web Flow and Spring Batch visual development tools
  • Spring Roo project wizard and integrated development shell
  • OSGi bundle overview and visual dependency graph
  • Spring AOP visualization of cross cutting reference model, bean cross references view and pointcut expression validation

Features in STS which needs mention

Features in STS which needs special mention are given below:

Spring Perspective

Eclipse perspective displaying views such as Spring Explorer and other standard Eclipse views: Servers, Spring Explorer, Task List, Outline, Console, Markers, and Progress. This is a convenient layout that can be customized according to your wish.

Spring Explorer View

This is the view which provides the ability to visualize the Bean Config files within Spring projects. Here you can view the beans graph visualizer, create bean config files, define Bean Config sets, define new beans, validate beans, and open MVC request mappings.

Project Explorer View

This view provides you with the ability to look at the project by its component types such as Spring Elements, Bean Config Files, Bean Config Sets, Web Service components, Java Resources, and more.

Spring MVC Request Mappings

Spring MVC is very powerful and easy to configure using annotations. Request Mappings are usually annotated in your java files and because it is scattered in various Java files, it’s quite difficult for a developer to see the overall mappings in an application in one place. This request mapping visualizer makes the developer life easy by giving a single view for such request mappings. The view provides the following details:

  • Handler Method
  • Resource URL
  • Resource Method: GET, POST, etc.
  • JavaDoc

Bean Config Sets

Bean config sets allow you to group bean config files together. Using Config Sets provides the ability to validate beans and bean relationships defined within multiple bean config files. Validation also provides suggestions via content assist when editing. STS performs cross-file validation on all config sets.

Visualizers in STS which needs mention

STS provides the ability to graphically view and edit various Spring configurations with ease. There are five visualizers which need special mention; they are used for viewing graphically Spring beans, Spring Batch, Spring Integration, Aspects and Web Flow.

Bean Graph

Visual diagram of the Beans and Bean Relationships within a config file or config set. From Project Explorer, expand the project under Spring Elements, right-click the Config Set name, and choose “Open Dependency Graph”.

 

Figure 2 Sample Bean Graph in SpringSource Tool Suite

Batch Graph

 

Figure 3 Sample Batch Graph in SpringSource Tool Suite

Integration Graph

The graph displays the standard Hohpe/Woolf diagrams from the Enterprise Integration Patterns book.

This visualizer is editable using the tool pallet on the left. The tool pallet only shows tools based on the namespaces included in the XML file.

Figure 4 Sample Integration Graph in SpringSource Tool Suite

Aspect Visualization

To see visualize Spring AOP aspects, use this view. To view this, select “Preferences > Visualizer”, under “Visualizers”, select “Spring AOP Provider”. You can also do this from the Visualizer view by clicking the down arrow in the view’s title bar and choosing preferences.

Figure 5 Sample Aspect Visualization in SpringSource Tool Suite

Web Flow Graph

The bean config editor provides the ability to edit the flows in XML or visually from the flow-graph tab.

Figure 6 Sample Web Flow Graph in SpringSource Tool Suite

Page Visitors: 7815

The following two tabs change content below.
Tomcy John

Tomcy John

Blogger & Author at javacodebook
He is an Enterprise Java Specialist holding a degree in Engineering (B-Tech) with over 10 years of experience in several industries. He's currently working as Principal Architect at Emirates Group IT since 2005. Prior to this he has worked with Oracle Corporation and Ernst & Young. His main specialization is on various web technologies and acts as chief mentor and Architect to facilitate incorporating Spring as Corporate Standard in the organization.
Tomcy John

Latest posts by Tomcy John (see all)

Leave a Reply

Your email address will not be published. Required fields are marked *