E-Book, Englisch, 335 Seiten
Ladd / Smeets Building Spring 2 Enterprise Applications
1. ed
ISBN: 978-1-4302-0500-5
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark
E-Book, Englisch, 335 Seiten
ISBN: 978-1-4302-0500-5
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark
This is a brilliantly practical work that lets the reader experience a real-world scalable agile enterprise Java-based application being built from the ground up using the latest Spring 2.x kit available. The open source agile lightweight Spring (meta) Framework 2.x is by far the leading innovative force and 'lightning rod' that's driving today's Java industry. Spring has time and time again proven itself in real-world highly scalable enterprise settings such as banks and other financial institutions. This book is the only authoritative Spring 2 authored book, as it has been written by team members of Interface21, the group that lead the Spring Foundation and its growing community.
Seth Ladd is a software engineer and professional Spring Framework trainer and mentor specializing in object-oriented and testable web applications. He started his own company building websites at age 17, but now enjoys having a real job. Currently working for Camber Corporation, Seth has built and deployed systems for NEC, Rochester Institute of Technology, Brivo Systems, and National Information Consortium. He has architected and developed enterprise applications in Java and C for both the server and remotely connected embedded devices. He enjoys speaking and teaching, and is a frequent presenter at local Java user groups and at corporate developer conferences. Seth is very thankful for living and working in Kailua, Hawaii, with his wife.
Autoren/Hrsg.
Weitere Infos & Material
1;Contents at a Glance;4
2;Contents;5
3;Introduction;11
3.1;Who This Book Is For;11
3.2;How This Book Is Structured;12
3.3;Prerequisites;12
3.4;Downloading the Code;13
4;CHAPTER 1 A Gentle Introduction to the Spring Framework;14
4.1;Building a Business Application;14
4.1.1;Java Platform Hurdles;15
4.1.2;Enter the Spring Framework;15
4.2;Introducing the Spring Framework Modules;15
4.3;Introducing the Sample Application;17
4.4;Managing Dependencies in Applications;18
4.4.1;A Use Case That Has Dependencies;18
4.4.2;Dealing with the Dependencies in Plain Java;22
4.4.3;Looking Up Dependencies with JNDI;24
4.4.4;Using the Spring Framework to Provide Dependencies;25
4.5;Integrating the Spring Framework with Java EE;32
4.5.1;Spring Framework Integration with Java EE Technologies;32
4.5.2;Spring and EJB;33
4.6;Setting Up the Spring Framework in Your Applications;34
4.7;Summary;35
5;CHAPTER 2 The Core Container;36
5.1;How Do Factories Work?;36
5.1.1;Factory Methods;37
5.1.2;Factory Objects;37
5.2;Introducing the BeanFactory;38
5.2.1;Creating a BeanFactory Object;39
5.2.2;Using Dependency Lookup;40
5.2.3;Using Dependency Injection;40
5.2.4;Using XML Tags for Bean Configuration;53
5.3;Examining the Bean Life Cycle;56
5.3.1;Bean Scope: Singleton or Prototype;56
5.3.2;Bean Initialization;61
5.3.3;Bean Destruction;64
5.4;Using Factory Methods and Factory Objects in the Container;67
5.4.1;Implementing Factory Methods;67
5.4.2;Implementing Factory Objects;69
5.4.3;Implementing Factory Objects with the FactoryBean Interface;70
5.5;Introducing the ApplicationContext;71
5.5.1;Representing Resources;71
5.5.2;Creating ApplicationContext Objects;72
5.6;Configuring the Container with Spring 2.0 XML Tags;75
5.7;Using the Container As a Deployment Model;76
5.8;Summary;76
6;CHAPTER 3 Aspect-Oriented Programming;77
6.1;Extending Applications the Traditional Way;77
6.1.1;Extending a Base Class;78
6.1.2;Using the Observer Design Pattern;79
6.1.3;Using the Decorator Design Pattern;81
6.1.4;Benefits of Separating Concerns;84
6.1.5;Limitations of Object-Oriented Solutions;85
6.1.6;Enter AOP;85
6.2;The Classic Spring AOP Framework;86
6.2.1;Implementing Cross-Cutting Concerns;86
6.2.2;Configuring AOP in the Spring Container;87
6.2.3;Using Proxy Objects;88
6.2.4;Filtering Methods;89
6.2.5;Selecting Advice Types;92
6.3;AOP Usage in the Spring Framework;99
6.4;Other Advice Classes;99
6.4.1;Logging Messages with Around Advice;99
6.4.2;Debugging with Around Advice;100
6.4.3;Limiting Concurrent Method Execution with Around Advice;100
6.5;Summary;101
7;CHAPTER 4 Spring AOP 2.0;102
7.1;Introducing AspectJ and Aspects;102
7.1.1;Join Points and Pointcuts in AspectJ;103
7.1.2;AspectJ Aspect Creation;104
7.2;Configuring @AspectJ-Style Aspects in Spring;105
7.2.1;A Simple @AspectJ-Style Aspect;105
7.2.2;@AspectJ-Style Advice Types;109
7.2.3;Pointcut Declaration and Reuse;113
7.2.4;Auto-Proxy Creation in the Spring Container;114
7.2.5;Advice and Aspect Ordering;115
7.3;Using AOP XML Tags;119
7.3.1;AOP Configuration Tags;119
7.3.2;XML Aspect Configuration;120
7.3.3;Pointcut Declaration and Reuse with XML;123
7.3.4;Advice Declaration in XML;124
7.3.5;Advice Ordering in XML;128
7.3.6;Advisors with AspectJ Pointcuts;128
7.3.7;Proxy Type Selection in XML;129
7.4;Working with Pointcuts;130
7.4.1;Selecting Methods Directly;131
7.4.2;Selecting Methods via Classes, Packages, and Inheritance;135
7.4.3;Selecting Methods via Annotations;136
7.5;Binding Advice Arguments;141
7.5.1;Binding Method Argument Values;143
7.5.2;Binding Return Values;144
7.5.3;Binding Exceptions;145
7.5.4;Binding Annotations;146
7.6;Summary;149
8;CHAPTER 5 Introduction to Data Access;150
8.1;Spring Integration with Data-Access Frameworks;150
8.2;The Challenges of Data Access;151
8.2.1;Effects of Data-Access Leakage;152
8.2.2;Database Resources;155
8.2.3;Exceptions Related to Data Access;162
8.2.4;Database Transactions;163
8.2.5;Abstractions;164
8.3;The Spring Solutions to Data Access;165
8.3.1;Managing Database Resources;166
8.3.2;Handling Data-Access Exceptions;167
8.3.3;Working with Database Transactions;167
8.4;Data-Access Leakage;169
8.4.1;Changing the Application;169
8.4.2;Abstractions for Data-Access Code;170
8.4.3;Using the Repository Adapter;172
8.5;The DataSource Interface and Connection Pools;174
8.5.1;Setting Up Connection Pools;175
8.5.2;Using Value Placeholders and Property Files;176
8.6;Summary;177
9;CHAPTER 6 Persistence with JDBC;178
9.1;Defining the Data Layer;178
9.2;Using the JdbcTemplate Class;180
9.2.1;Using the JdbcDaoSupport Class;183
9.2.2;Working with Database Data;184
9.3;Using Callbacks;187
9.3.1;Using the RowMapper Interface;188
9.3.2;Using the PreparedStatementSetter Interface;189
9.4;Using Executable Query Objects;190
9.4.1;Using the MappingSqlQuery Class;190
9.4.2;Using the SqlUpdate Class;192
9.4.3;Using the StoredProcedure Class;194
9.5;Creating Batches;195
9.6;Working with LOBs;196
9.7;Using the NativeJdbcExtractor Interface;197
9.8;Introducing New Spring 2.0 Features;199
9.8.1;Using the SimpleJdbcTemplate Class;199
9.8.2;Performing JNDI Data Source Lookups;200
9.9;Summary;201
10;CHAPTER 7 Transaction Management;202
10.1;Database Transactions;202
10.2;Transaction Management in Spring;203
10.2.1;Configuring Spring’s Transaction Manager for JDBC;205
10.2.2;Configuring Spring’s Transaction Manager for JTA;205
10.3;Transaction Demarcation in Spring;206
10.3.1;Transaction Demarcation Introduced in Spring 1.0;207
10.3.2;Transaction Demarcation Introduced in Spring 1.2;214
10.3.3;Transaction Demarcation Introduced in Spring 2.0;220
10.4;Summary;223
11;CHAPTER 8 Spring MVC;224
11.1;Web Application Architecture;225
11.1.1;The Domain Model;227
11.1.2;The Data-Access Layer;227
11.1.3;Web Request Routing;227
11.1.4;User Interface;228
11.2;Spring MVC Architecture;228
11.2.1;MVC Components;228
11.2.2;DispatcherServlet and Request Handling;231
11.3;Spring MVC Configuration;233
11.3.1;Writing web.xml;234
11.3.2;Creating ApplicationContexts;236
11.3.3;Reviewing the Web Application Startup Process;236
11.4;A Sample Spring MVC Application;237
11.4.1;Configuring the Sample Application;237
11.4.2;Implementing the List All Members Use Case;240
11.4.3;Implementing the Search for a Member Use Case;248
11.4.4;Implementing the Register a New Member Use Case;250
11.4.5;Reviewing the Sample Application Implementation;271
11.5;Summary;272
12;CHAPTER 9 View Technologies;273
12.1;Choosing a View Technology;273
12.2;Using View Resolvers;274
12.2.1;Using General-Purpose View Resolvers;274
12.2.2;Combining View Resolvers;275
12.3;Using View Technologies;275
12.3.1;JSP;276
12.3.2;Velocity;279
12.3.3;FreeMarker;281
12.3.4;XSLT;282
12.3.5;PDF;284
12.3.6;Excel;286
12.3.7;JasperReports;287
12.4;Introducing New Spring 2.0 Form Tags;289
12.5;Summary;292
13;CHAPTER 10 Testing;293
13.1;Introducing Testing Approaches;293
13.1.1;Unit Testing;294
13.1.2;Integration Testing;295
13.1.3;Test-Driven Development;295
13.2;Writing Unit Tests Using JUnit;296
13.2.1;Establishing the Requirements;296
13.2.2;Writing the Test;299
13.2.3;Definining a Test Suite;301
13.3;Creating Mock Implementations with EasyMock;303
13.3.1;Defining and Implementing the Interface;303
13.3.2;Creating a Mock Object;304
13.3.3;Testing with EasyMock;305
13.4;Using Spring Support for Integration Testing;307
13.4.1;Testing Without Transactions;308
13.4.2;Testing with Transactions;310
13.4.3;Testing with a DataSource;310
13.5;Using Spring Mock Classes;310
13.6;Summary;311
14;APPENDIX Installing the Eclipse Web Tools Platform;312
14.1;Installing Tomcat;313
14.2;Installing Eclipse;313
14.3;Installing WTP;314
14.4;Starting a New Web Project;319
15;Index;327




