Beginning Spring Boot 2: applications and microservices with the Spring framework 9781484229309, 9781484229316, 1484229304

Learn Spring Boot and how to build Java-based enterprise, web, and microservice applications with it. In this book, you&

708 104 5MB

English Pages 304 [313] Year 2017;2018

Report DMCA / Copyright

DOWNLOAD PDF FILE

Table of contents :
Contents at a Glance......Page 4
Contents......Page 6
About the Author......Page 14
About the Technical Reviewer......Page 15
Acknowledgments......Page 16
Introduction......Page 17
Overview of the Spring Framework......Page 19
Spring Configuration Styles......Page 20
Developing Web Application Using SpringMVC and JPA......Page 21
A Quick Taste of Spring Boot......Page 34
Embedded Servlet Container Support......Page 37
Summary......Page 38
Spring Boot Starters......Page 39
Easy-to-Use Embedded Servlet Container Support......Page 40
Using Spring Initializr......Page 41
Using the Spring Tool Suite......Page 42
Using Intellij IDEA......Page 43
Exploring the Project......Page 44
The Application Entry Point Class......Page 49
Spring Boot Using Gradle......Page 50
Summary......Page 51
Exploring the Power of @Conditional......Page 52
Using @Conditional Based on System Properties......Page 53
Using @Conditional Based on the Configured Spring Beans......Page 55
Using @Conditional Based on a Property’s Configuration......Page 56
Spring Boot’s Built-In @Conditional Annotations......Page 57
How Spring Boot Autoconfiguration Works......Page 59
Summary......Page 62
Logging......Page 63
Type-Safe Configuration Properties......Page 65
Validating Properties with the Bean Validation API......Page 66
Developer Tools......Page 67
Summary......Page 69
Using JdbcTemplate Without SpringBoot......Page 70
Initializing the Database......Page 73
Using Other Connection Pooling Libraries......Page 77
Database Migration with Flyway......Page 78
Summary......Page 79
Using the Spring Boot MyBatis Starter......Page 80
Summary......Page 84
Introduction to JOOQ......Page 85
Using Spring Boot’s JOOQ Starter......Page 86
Database Schema......Page 87
Code Generation Using the JOOQ Maven Codegen Plugin......Page 88
Add JOOQ Generated Code as a Source Folder......Page 90
Using JOOQ DSL......Page 91
Summary......Page 96
Introducing the Spring Data JPA......Page 97
Using Spring Data JPA with Spring Boot......Page 99
Using the Sort and Pagination Features......Page 102
Working with Multiple Databases......Page 103
Use OpenEntityManagerInViewFilter for Multiple Data Sources......Page 110
Summary......Page 111
Introducing MongoDB......Page 112
Installing MongoDB on Windows......Page 113
Getting Started with MongoDB Using the Mongo Shell......Page 114
Introducing Spring Data MongoDB......Page 115
Using Embedded Mongo for Testing......Page 118
Summary......Page 119
Introducing SpringMVC......Page 120
Developing Web Application Using Spring Boot......Page 122
Using the Tomcat, Jetty, and Undertow Embedded Servlet Containers......Page 125
Customizing Embedded Servlet Containers......Page 127
Customizing SpringMVC Configuration......Page 128
Registering Servlets, Filters, and Listeners as Spring Beans......Page 129
Spring Boot Web Application as a Deployable WAR......Page 132
View Templates that Spring Boot Supports......Page 133
Using the Thymeleaf View Templates......Page 134
Working with Thymeleaf Forms......Page 135
Form Validation......Page 137
Using ResourceBundles for Internationalization (i18n)......Page 141
ResourceBundles for Hibernate Validation Errors......Page 142
Error Handling......Page 143
Summary......Page 145
Introduction to RESTful Web Services......Page 146
REST API Using SpringMVC......Page 147
Class- and Method-Level CORS Configuration......Page 157
Global CORS Configuration......Page 158
Exposing JPA Entities with Bi-Directional References Through RESTful Services......Page 159
Using @JsonIgnore......Page 160
Using @JsonManagedReference and @JsonBackReference......Page 161
REST API Using Spring Data REST......Page 162
Sorting and Pagination......Page 164
Exception Handling......Page 166
Summary......Page 168
Introduction to Reactive Programming......Page 169
Project Reactor......Page 170
Reactive Web Applications Using Spring WebFlux......Page 171
WebFlux Using the Annotation-Based Programming Model......Page 172
HandlerFunction......Page 175
ServerResponse......Page 176
HandlerFilterFunction......Page 177
Registering HandlerFunctions as Method References......Page 178
Thymeleaf Reactive Support......Page 181
Reactive WebClient......Page 184
Testing Spring WebFlux Applications......Page 185
Summary......Page 186
Spring Security in Spring Boot Web Application......Page 187
Simple Hash-Based Token as Cookie......Page 196
Persistent Tokens......Page 198
Cross-Site Request Forgery......Page 199
Method-Level Security......Page 200
Securing the REST API Using Spring Security......Page 202
Summary......Page 207
Introducing the Spring Boot Actuator......Page 208
Exploring Actuator’s Endpoints......Page 210
The /info Endpoint......Page 211
The /beans Endpoint......Page 212
The /autoconfig Endpoint......Page 213
The /configprops Endpoint......Page 215
The /metrics Endpoint......Page 216
The /env Endpoint......Page 217
The /trace Endpoint......Page 218
The /dump Endpoint......Page 219
The /loggers Endpoint......Page 220
The /shutdown Endpoint......Page 222
The /actuator Endpoint......Page 223
Customizing Actuator Endpoints......Page 224
Securing Actuator Endpoints......Page 225
Implementing Custom Health Indicators......Page 226
Capturing Custom Application Metrics......Page 228
Monitoring and Management Over JMX......Page 230
Summary......Page 231
Testing Spring Boot Applications......Page 232
Testing with Mock Implementations......Page 236
Testing with Mockito......Page 238
Testing Slices of Application Using @*Test Annotations......Page 241
Testing SpringMVC Controllers Using @WebMvcTest......Page 242
Testing SpringMVC REST Controllers Using @WebMvcTest......Page 243
Testing Secured Controller/Service Methods......Page 245
Approach One......Page 251
Testing Persistence Layer Components Using @DataJpaTest and @JdbcTest......Page 252
Summary......Page 257
Introducing Twitter4j......Page 258
Custom Spring Boot Starter......Page 259
Create the twitter4j-spring-boot-autoconfigure Module......Page 260
Twitter4j Properties to Hold the Twitter4j Config Parameters......Page 261
Twitter4j Autoconfiguration to Autoconfigure Twitter4j......Page 263
Create the twitter4j-spring-boot-starter Module......Page 264
Application Using twitter4j-spring-boot-starter......Page 266
Summary......Page 268
Groovy Strings......Page 269
JavaBean Properties......Page 270
Looping......Page 271
Creating a Spring Boot Application Using Groovy......Page 272
Type Inference......Page 276
Traits......Page 277
Creating a Spring Boot Application Using Scala......Page 278
Interfaces......Page 282
Creating a Spring Boot Application Using Kotlin......Page 283
Summary......Page 288
Installing JHipster......Page 289
Creating a JHipster Application......Page 290
Creating Entities......Page 293
Using JDL Studio......Page 294
Managing Relationships......Page 295
Summary......Page 297
Running Spring Boot Applications in Production Mode......Page 298
Deploying Spring Boot Application on Heroku......Page 300
Installing Docker......Page 305
Running a Spring Boot Application in a Docker Container......Page 306
Running Multiple Containers Using docker-compose......Page 308
Summary......Page 309
Index......Page 310

Beginning Spring Boot 2: applications and microservices with the Spring framework
 9781484229309, 9781484229316, 1484229304

  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Recommend Papers