Beginning Spring. Höller Jürgen

Чтение книги онлайн.

Читать онлайн книгу Beginning Spring - Höller Jürgen страница 3

Beginning Spring - Höller Jürgen

Скачать книгу

or bean injections and method invocations. It also supports mathematical and relational operators along with regular expressions. SpEL can be easily used with other subprojects of Spring, such as Security or Caching. It's also technology-agnostic, so it can be used separately without depending on the Spring context. We cover each of these features with self-contained working samples.

      Spring Transaction Management and AOP

      Data integrity is one of the key points of every system that deals with the data. System behavior such as incorrect account balances, lost orders, or missing entries in a document will definitely be considered unacceptable by the system's users. Transaction management provides a way to achieve integrity on the data. Spring provides extensive transaction management to ensure this data integrity and consistency for enterprise applications. Chapter 6 uses sample code to show how Spring provides declarative and programmatic transaction mechanisms, the differences in local and global transactions, propagation rules on the transactions, and the commit/rollback architecture of the framework.

      To implement the cross-cutting concerns, Spring AOP provides easy definition of the elements of AOP with XML configuration, but it also supports the AspectJ framework annotations to easily configure the application.

      Spring MVC and Developing RESTful Web Services

      With the Model View Controller (MVC) pattern, the enterprise application can be clearly defined with three layers. Model is the part of the application that handles the logic for the application data. View is the part that handles the display of the data, and Controller is the part that handles the user interaction. Spring provides an MVC subproject to handle the HTTP requests by reducing the boilerplate code needed for accessing request parameters, validations, and conversations and model updates. It also provides a convenient way to define RESTful web services to be used with cutting-edge user-interface frameworks to provide more responsive web applications.

      Spring Security

      Spring Security is the subproject that provides first-class authentication and authorization support for Java-based enterprise applications. The project first started as codename Acegi and then merged into the Spring portfolio. The project conforms to the Servlet API, so it's easy to integrate it with a Java EE–based web application. It also provides optional integration with other Spring frameworks, such as MVC, so it gives consistent usage on its features. In Chapter 12 we provide some neat examples for these feature foundations.

      Spring Cache

      By starting with version 3.1, Spring Framework provides a transparent caching abstraction for enterprise applications by employing various caching frameworks, such as Ehcache and Hazelcast, in the backend.

      The main objective of caching is to reduce the execution of targeted methods by caching the results of method returns with their executed parameters.

       NOTE The Spring Framework is a comprehensive toolset that cannot be covered in a beginner-level book with all of its subprojects and the whole set of their features. This book might not be suitable for readers who seek a showdown of Spring subprojects with an end-to-end explanation.

      This book also focuses on version 4.0.5.RELEASE of the framework, which is the most recent version at the time of writing. Thus the older versions of the framework are not covered with their features in this book.

      WHAT YOU NEED TO RUN THE SAMPLES

      To run the samples that reside in the book you will need

      • Java Development Kit (JDK) 8.0

      • Maven project build and management tool: You can find all the samples given in the book at www.wrox.com/go/beginningspring on the Download Code tab with the Maven-based project structure.

      NOTE Maven demands that the Java Development Kit be installed on your local environment instead of the Java Runtime Environment.

      • A Java web container: For running the web project samples given throughout the book we've used Tomcat 8.0.12 and Jetty version 9.2.3.

      • A Java IDE: The samples given in the book are implemented with Eclipse IDE, but because Maven is used for the project structure, you could build the samples with other IDEs such as NetBeans or IntelliJ IDEA without any difficulty.

      CONVENTIONS

      To help you get the most from the text and keep track of what's happening, we've used a number of conventions throughout the book.

      TRY IT OUT

      The Try It Out is an exercise you should work through, following the text in the book.

      1. They usually consist of a set of steps.

      2. Each step has a number.

      3. Follow the instructions in the steps to complete the activity.

       How It Works

      After each Try It Out, the code you've typed is explained in detail.

       WARNING Boxes like this one hold important, not-to-be forgotten information that is directly relevant to the surrounding text.

       NOTE Notes, tips, hints, tricks, and asides to the current discussion are offset and placed in italic like this.

      As for styles in the text:

      • We highlight new terms and important words when we introduce them.

      • We show filenames, URLs, and code within the text like so: persistence.properties.

      • We present code in two different ways:

      We use a monofont type with no highlighting for most code examples.

      We use bold to emphasize code that's particularly important in the present context.

      Source Code

      As you work through the examples in this book, you may choose either to type in all the code manually or to use the source code files that accompany the book. All of the source code used in this book is available for download at www.wrox.com/go/beginningspring. You will find that the code snippets from the source code are accompanied by a download icon and note indicating the name of the program so you know it's available for download and can easily locate it in the download file. Once at the site, simply locate the book's title (either by using the Search box or by using one of the title lists) and click the Download Code link on the book's detail page to obtain all the source code for the book.

      NOTE Because many books have similar titles, you may find it easiest to search by ISBN; this book's ISBN is 978-1-118-89292-3.

      After you download the code, just decompress it with your favorite compression tool. Alternatively, you can go to the main Wrox code download page at http://www.wrox.com/dynamic/books/download.aspx to see the code available for this book and all other Wrox books.

      ERRATA

Скачать книгу