万本电子书0元读

万本电子书0元读

顶部广告

Learning Spring 5.0电子书

售       价:¥

15人正在读 | 0人评论 9.8

作       者:Tejaswini Mandar Jog

出  版  社:Packt Publishing

出版时间:2017-07-07

字       数:52.7万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:此类商品不支持退换货,不支持下载打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Build, test, and secure robust enterprise-grade applications using the Spring Framework About This Book ? Build an enterprise application throughout the book that communicates with a microservice ? Define and inject dependencies into your objects using the IoC container ? Make use of Spring’s reactive features including tools and implement a reactive Spring MVC application Who This Book Is For This book is for Java developers who want to make use of the Spring framework to simplify their programming needs. What You Will Learn ? Get to know the basics of Spring development and gain fundamental knowledge about why and where to use Spring Framework ? Explore the power of Beans using Dependency Injection, wiring, and Spring Expression Language ? Implement and integrate a persistent layer in your application and also integrate an ORM such as Hibernate ? Understand how to manage cross-cutting with logging mechanism, transaction management, and more using Aspect-oriented programming ? Explore Spring MVC and know how to handle requesting data and presenting the response back to the user ? Get to grips with the integration of RESTful APIs and Messaging with WebSocket and STOMP ? Master Reactive Programming using Spring MVC to handle non-blocking streams In Detail Spring is the most widely used framework for Java programming and with its latest update to 5.0, the framework is undergoing massive changes. Built to work with both Java 8 and Java 9, Spring 5.0 promises to simplify the way developers write code, while still being able to create robust, enterprise applications. If you want to learn how to get around the Spring framework and use it to build your own amazing applications, then this book is for you. Beginning with an introduction to Spring and setting up the environment, the book will teach you in detail about the Bean life cycle and help you discover the power of wiring for dependency injection. Gradually, you will learn the core elements of Aspect-Oriented Programming and how to work with Spring MVC and then understand how to link to the database and persist data configuring ORM, using Hibernate. You will then learn how to secure and test your applications using the Spring-test and Spring-Security modules. At the end, you will enhance your development skills by getting to grips with the integration of RESTful APIs, building microservices, and doing reactive programming using Spring, as well as messaging with WebSocket and STOMP. Style and approach Filled with examples, this tutorial-based book will help you gain all the knowledge you need to start producing enterprise-grade applications with Spring.
目录展开

Title Page

Copyright

Learning Spring 5.0

Credits

About the Author

About the Reviewer

www.PacktPub.com

Why subscribe?

Customer Feedback

Preface

What this book covers

What you need for this book

Who this book is for

Conventions

Reader feedback

Customer support

Downloading the example code

Errata

Piracy

Questions

Spring at Glance

Introduction to the Spring Framework

Problems addressed by Spring

Scalability

Plumbing code

Boiler plate code

Unavoidable non-functional code

Unit testing of the application

POJO-based development

Loose coupling through the dependency injection

Declarative programming

Boilerplate code reduction using aspects and templates

Layered architecture

Spring architecture

Core modules

Core

Beans

Context

SpEL

Data access and integration modules

JDBC (DAO)

ORM

OXM

JMS

Transaction

Web MVC and remoting modules

Web

Servlet

Portlet

WebSocket

AOP modules

AOP

Aspects

Instrumentation modules

Instrumentation

Instrument Tomcat

Messaging

Test module

What more Spring supports underneath?

Security module

Batch module

Spring integration

Mobile module

LDAP module

The new module

Spring road map

1.0 March 2004

2.0 October 2006

2.5 November 2007

3.0 GA December 2009

3.1 GA December 2011

4.0 December 2013

5.0 RC1

Container - the heart of Spring

Inversion of Control

BeanFactory--the past

XMLBeanFactory

ApplicationContext--the present

ClassPathXmlApplicationContext

FileSystemXmlApplicationContext

WebXmlApplicationContext

How are beans made available from container?

Summary

Dependency Injection

The life of a bean

Loading the configuration

Object creation

Setting the bean name

Setting the bean factory

Bean post processing with postProcessBeforeInitialization

Property population

Initializing the bean

The afterPropertiesSet() method

The Custom init() method

Bean post processing with postProcessAfterInitialization

Use the bean

Destruct the bean

Dispose the bean with destroy()

Destruction with custom destroy()

Case 1: Using custom initialization and destruction methods

Case 2: Using InitializingBean to provide initialization

Case 3: Using DisposableBean to provide release of memory

Case 4: Making the bean aware of the container

Case 5: Using BeanPostProcessor

Using JSR-250 annotations for the bean life cycle

Instance creation

Using constructor

Using factory method

Using instance factory method

Using static factory method

Dependency injection

XML-based configuration

Setter injection

Constructor injection

Way 1: Without ambiguities

Way 2: With ambiguities

Namespace p for property

Namespace p for property of secondary types

Configuring the inner beans

Inheritance mapping

Configuring the null values

Configuring Collection

Bean scope

Annotation-based configuration

Spring-based annotations

Stereotype annotations

Wiring annotations

Case 1 - Using @Autowired

Case 2 - Using autowired=false

Case 3 - Using @Qualifier

Case 3 - Using @Required

Case 4 - Scope management annotations

JSR standard annotation

Annotations for life cycle

Spring Expression Language

Using literals

Using bean reference

Using mathematical, logical, and relational operators

Summary

Accelerate with Spring DAO

Handling databases

DataSource

Configuring DataSource

Case 1 - Using XML configuration of DriverManagerDataSource

Case 2 - Using annotations for DriverManagerDataSource

Using template classes to perform JDBC operations

JdbcTemplate

NamedParameterJdbcTemplate

Using JdbcTemplate

Using NamedParameterJdbctemplate

SimpleJdbcInsert

SimpleJdbcCall

Modeling JDBC operations

Handling exceptions

Object relation mapping

Hibernate

Hibernate architecture

Configuration interface

The SessionFactory interface

Session interface

Transaction interface

Query interface

Criteria interface

Case 1 - Using SessionFactory

Cache declaration

@Cacheable

@Caching

@CacheConfig

@CacheEvict

@CachePut

The cache configuration

Summary

Aspect-Oriented Programming

Core and cross-cutting concerns

Aspect-oriented programming

Join point

Pointcut

Advice

Before

After

After returning

After throwing

Around

Aspect

Introduction

Target object

AOP proxy

Weaving

AspectJ

AspectWertz

JBoss AOP

Dynaop

CAESAR

Spring AOP

XML-based aspect configuration

Using method signatures

Using type

Using Bean name

Using this

Using target

For annotation tracking

Part 1 - Creating applications for the core concern (JDBC)

Part 2 - Integration of Log4j

Part 3 - Writing logging aspects

Adding After advice

Adding After Returning advice

Adding Around advice

Adding After throwing advice

Annotation-based aspects

Introduction advice

Summary

Be Consistent - Transaction Management

Understanding transactions

Atomicity

Consistency

Isolation

Durability

Life cycle of transaction management

Local transaction

Global or distributed transactions

Spring and transaction management

Programmatic transaction management

Using PlatformTransactionManager

TransactionTemplate

Declarative transaction management

XML-based declarative transaction management

Annotation-based transaction management

Summary

Exploring Spring MVC

Features for faster development

The Spring MVC

The Front Controller DispatcherServlet

The controller

The ModelAndView interface

The ModelMap interface

The ViewResolver interface

First Spring MVC demo

A deep dive into Spring MVC

Case 1 - Reading request parameters

@RequestMapping variants

Case 2 - Handling form submission

Form submission

Displaying the form

Postprocessing the form

Form preprocessing

Defining the attribute with values to add in the view

Populating the values of the attribute in the form

Performing Form Validation in Spring MVC

Custom validator based on Spring Validator interface

Using @InitBinder and @Valid for validation

Externalizing the messages

Using ValidationUtils

JSR annotation-based validation

Part 1 - Creating a basic application

Part 2 - Applying validations

Using the message attribute

Using the properties file

Summary

Be Assured, Take a Test Drive

Testing - an important step

Unit testing

Integration testing

System testing

User acceptance testing

Testing tools

JTest

JMeter

Grinder

JWalk

PowerMock

TestNG

The Arquillian framework

The ShrinkWrap framework

Test runners

Java container

Integration of test cases into the Java container

JUnit

Phase 1 - Unit testing DAO Unit testing by JUnit

Creating a base application

Performing testing

Spring TestContext framework

@ContextConfiguration

@WebAppConfiguration

Mock testing

Mockito

Spring MVC controller testing using the Spring TestContext framework

Spring MockMvc

Phase 2 - Integration testing

Integration testing of service and DAO layers

Integration testing of controller and service layer

Phase 3 - System testing

Using Eclipse IDE for deployment

Manually deploying the application

Summary

Make It Safe - Security Management

Importance of security in an application

Authentication

Basic authentication

Form-based authentication

Authorization

The Spring Security framework

New features added in Spring Security 5.0

Core components of Spring Security

SecurityContextHolder

Authentication

UserDetailsService

GrantedAuthority

AuthenticationManager

Spring Security mechanism

Configuring security in Spring via namespace

Configuring filters

Configuring <http>

Configuring AuthenticationManager

Step 1 - Creating a basic Spring MVC application

Step 2 - Adding security

In-memory authentication

The JDBC authentication

The Remember-Me authentication

Logout

Demo logout

Managing the Session

Working of the Spring session

Demo of Session management to limit maximum session to handle per user

Method-level security

@Secured

@PreAuthorize and @PostAuthorize

Demo applying method-level security

Summary

Explore the Power of RESTful Web Services

Web services

Web services, the need

Usability

Reusing the developed application

Loosely-coupled modules

Ease in deployment

Types of web service

SOAP web service

RESTful web service

Spring and RESTful web services

RestTemplate

Presentation of the data

HTTP-based message converters

Negotiating view-based rendering of the view

Summary

Exchange Information - Use Messaging

Spring and messaging

Using WebSocket

Overview of the WebSocket API

Creating a WebSocketHandler

Registering WebSocketHandler

Java-based configuration

XML-based configuration

WebSocket engine configuration

Configuration of allowed origins

SockJS

STOMP

Spring STOMP support

Summary

Be Active - Reactive Programming

Introduction to Reactive Streams

Reactive Stream implementations

RxJava 1.x and RxJava2.x

Akka

Components of the Akka toolkit

ActorSystem

ActorRef

MessageDispatcher

MailBox

MessageQueue

Actor

Vert.x

Slick

Project Reactor

Operators

Reactive types

The Future interface

Understanding stream

Reactive streams in depth

Back pressure

Spring WebMVC and Spring web reactive programming

The reactive web application

WebClient

Summary

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部