万本电子书0元读

万本电子书0元读

顶部广告

Spring Cookbook电子书

售       价:¥

11人正在读 | 0人评论 9.8

作       者:Jér?me Jaglale

出  版  社:Packt Publishing

出版时间:2015-05-25

字       数:99.5万

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

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
This book is for you if you have some experience with Java and web development (not necessarily in Java) and want to become proficient quickly with Spring.
目录展开

Spring Cookbook

Table of Contents

Spring Cookbook

Credits

About the Author

About the Reviewers

www.PacktPub.com

Support files, eBooks, discount offers, and more

Why Subscribe?

Free Access for Packt account holders

Preface

What this book covers

What you need for this book

Who this book is for

Sections

Getting ready

How to do it…

How it works…

There's more…

See also

Conventions

Reader feedback

Customer support

Downloading the example code

Errata

Piracy

Questions

1. Creating a Spring Application

Introduction

Installing Java, Maven, Tomcat, and Eclipse on Mac OS

How to do it…

Installing Java

Installing Maven

Installing Tomcat

Installing Eclipse

There's more…

Installing Java, Maven, Tomcat, and Eclipse on Ubuntu

How to do it…

Installing Java

Installing Maven

Installing Tomcat

Installing Eclipse

There's more…

Installing Java, Maven, Tomcat, and Eclipse on Windows

How to do it…

Installing Java

Installing Maven

Installing Tomcat

Installing Eclipse

Creating a Spring web application

How to do it…

Creating a new Maven project in Eclipse

Adding Spring to the project using Maven

Creating the configuration classes for Spring

Creating a "Hello World" web page

How it works…

Creating a new Maven project in Eclipse

Adding Spring to the project using Maven

Creating the configuration classes for Spring

Creating a "Hello World" web page

Running a Spring web application

How to do it…

How it works…

There's more…

Using Spring in a standard Java application

How to do it…

Creating a new Maven project in Eclipse

Adding Spring to the project using Maven

Creating a configuration class for Spring

Creating the User class

Defining a User singleton in the Spring configuration class

Using the User singleton in the main() method

How it works...

2. Defining Beans and Using Dependency Injection

Introduction

Defining a bean explicitly with @Bean

How to do it…

How it works…

There's more…

Defining a bean implicitly with @Component

Getting ready

How to do it…

How it works…

There's more…

Using a bean via dependency injection with @Autowired

Getting ready

How to do it…

How it works…

There's more…

Using a bean directly

Getting ready

How to do it…

How it works…

There's more…

Listing all beans

Getting ready

How to do it…

How it works…

There's more…

Using multiple configuration classes

Getting ready

How to do it…

There's more…

3. Using Controllers and Views

Introduction

Associating a route to a controller method

How to do it…

How it works…

Using a JSP view

How to do it…

How it works…

There's more…

Passing attributes from a controller to a JSP view

How to do it…

How it works…

Using dynamic route parameters in a controller method

How to do it…

How it works…

Using a common prefix for the routes of a controller

How to do it…

How it works…

Using a page template with Tiles

How to do it…

How it works…

There's more…

Organizing the JSP with subfolders

Using multiple page templates

Defining page titles only once using a text attribute

Executing some code before and after controllers using interceptors

How to do it…

How it works…

There's more…

Building multilingual pages

How to do it…

How it works…

There's more…

Getting the current language

Using the language in the URL

4. Querying a Database

Introduction

Connecting to a database

Getting ready

How to do it…

How it works…

Creating a DAO class

How to do it…

How it works…

Calling a DAO method from a controller class

Getting ready

How to do it…

How it works…

Saving an object

Getting ready

How to do it…

How it works…

Retrieving an object

How to do it…

How it works…

There's more…

Retrieving a list of objects

How to do it…

How it works…

Retrieving a list of objects with their dependencies

Getting ready

How to do it…

How it works…

Updating an object

How to do it…

There's more…

Deleting an object

How to do it…

Finding the number of results for an SQL query

How to do it…

Saving a list of objects at once

How to do it…

How it works…

Reverting incomplete database modifications using transactions

How to do it…

How it works…

Using Hibernate for powerful object persistence and querying

Getting ready

How to do it…

5. Using Forms

Introduction

Displaying and processing a form

How to do it…

How it works…

There's more…

See also

Getting a submitted form value using a controller method argument

How to do it…

How it works…

There's more…

See also

Setting a form's default values using a model object

How to do it…

How it works…

Saving form data in an object automatically

How to do it…

How it works…

There's more…

Using text, textarea, password, and hidden fields

How to do it…

How it works…

Using a select field

How to do it…

How it works…

There's more…

Using a List<String> object

Using a List<Object> object

Using a checkbox

How to do it…

How it works…

Using a list of checkboxes

How to do it…

How it works…

There's more…

Using a list of radio buttons

How to do it…

How it works…

There's more…

Validating a form using annotations

How to do it…

How it works…

There's more…

Uploading a file

How to do it…

How it works…

There's more…

6. Managing Security

Introduction

Enabling Spring Security

How to do it…

How it works…

Authenticating users using the default login page

How to do it…

How it works…

Authenticating users using a custom login page

How to do it…

How it works…

Authenticating users using a database

How to do it…

How it works…

Adding a logout link

How to do it…

How it works…

Using public folders

How to do it…

There's more…

Authorizing only users with a specific role to view some pages

How to do it…

How it works…

Displaying page elements only to authenticated users in views

How to do it…

How it works…

There's more…

Using HTTPS with Tomcat

How to do it…

How it works…

There's more…

7. Unit Testing

Introduction

Unit testing with JUnit 4

Getting ready

How to do it…

How it works…

There's more…

Unit testing with TestNG 6

Getting ready

How to do it…

How it works…

There's more…

Simulating dependencies with mocks using Mockito

Getting ready

How to do it…

How it works…

There's more…

Unit testing with JUnit 4 using Spring's application context

How to do it…

How it works…

There's more…

Unit testing with TestNG 6 using Spring's application context

How to do it…

How it works…

There's more…

Unit testing with transactions

How to do it…

How it works…

Unit testing controller methods

Getting ready

How to do it…

How it works…

There's more…

8. Running Batch Jobs

Introduction

Installing and configuring Spring Batch

How to do it…

How it works…

Creating a job

How to do it…

How it works…

There's more…

Executing a job from the command line

Getting Ready

How to do it…

There's more…

Executing a job from a controller method

Getting ready

How to do it…

How it works…

Using job parameters

Getting ready

How to do it…

How it works…

Executing a system command

Getting ready

How to do it…

How it works…

There's more…

Scheduling a job

Getting ready

How to do it…

How it works…

There's more…

Creating a read/process/write step

Getting ready

How to do it…

How it works…

There's more…

Reading an XML file

Getting ready

How to do it…

How it works…

Generating a CSV file

Getting ready

How to do it…

How it works…

Reading from a database

Getting ready

How to do it…

How it works…

Unit testing batch jobs

How to do it…

How it works…

9. Handling Mobiles and Tablets

Introduction

Installing Spring Mobile

How to do it…

How it works…

There's more…

Detecting mobiles and tablets

How to do it…

How it works…

Switching to the normal view on mobiles

How to do it…

How it works…

There's more…

Using different JSP views for mobiles automatically

How to do it…

How it works…

There's more…

Using a .mobi domain name on mobiles

Getting ready

How to do it…

How it works…

Using an m. subdomain on mobiles

Getting ready

How to do it…

How it works…

Using a different domain name on mobiles

Getting ready

How to do it…

How it works…

Using a subfolder path on mobiles

Getting ready

How to do it…

How it works…

10. Connecting to Facebook and Twitter

Introduction

Creating a Facebook app

Getting ready

How to do it…

Creating a test Facebook app and test users

Getting ready

How to do it…

How it works…

Connecting to Facebook

Getting ready

How to do it…

How it works…

Retrieving a Facebook user's profile

Getting ready

How to do it…

How it works…

There's more…

Retrieving the list of friends of a Facebook user

Getting ready

How to do it…

How it works…

Posting a Facebook status update

Getting ready

How to do it…

Posting a link to Facebook

Getting ready

How to do it…

Posting a custom object to Facebook

Getting ready

How to do it…

Creating a Twitter application

Getting ready

How to do it…

Connecting to Twitter

Getting ready

How to do it…

How it works…

Retrieving a user's Twitter profile

Getting ready

How to do it…

Retrieving the tweets of a Twitter user

Getting ready

How to do it…

Posting a tweet to Twitter

Getting ready

How to do it…

Sending a private message to another Twitter user

Getting Ready

How to do it…

11. Using the Java RMI, HTTP Invoker, Hessian, and REST

Introduction

Creating a Java RMI service

Getting ready

How to do it…

How it works…

Querying an existing Java RMI service

Getting ready

How to do it…

How it works…

Creating an HTTP Invoker service

Getting ready

How to do it…

How it works…

Querying an existing HTTP Invoker service

Getting ready

How to do it…

How it works…

Creating a Hessian service

Getting ready

How to do it…

How it works…

Querying an existing Hessian service

Getting ready

How to do it…

How it works…

Creating a REST service

Getting ready

How to do it…

How it works…

There's more…

Querying an existing REST service

Getting ready

How to do it…

How it works…

There's more…

12. Using Aspect-oriented Programming

Introduction

Creating a Spring AOP aspect class

How to do it…

How it works…

Measuring the execution time of methods using an around advice

Getting ready

How to do it…

How it works…

Logging method arguments using a before advice

Getting ready

How to do it…

How it works…

Logging methods' return values using an after-returning advice

Getting ready

How to do it…

How it works…

Logging exceptions using an after-throwing advice

Getting ready

How to do it…

How it works…

Using an after advice to clean up resources

Getting ready

How to do it…

How it works…

Making a class implement an interface at runtime using an introduction

Getting ready

How to do it…

How it works…

Setting the execution order of the aspects

Getting ready

How to do it…

How it works…

There's more…

Index

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

发表评论

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

买过这本书的人还买过

读了这本书的人还在读

回顶部