Beginning Spring Boot 2 - K. Siva Prasad Reddy

Beginning Spring Boot 2 (eBook)

Applications and Microservices with the Spring Framework
eBook Download: PDF
2017 | 1st ed.
XX, 304 Seiten
Apress (Verlag)
978-1-4842-2931-6 (ISBN)
Systemvoraussetzungen
66,99 inkl. MwSt
  • Download sofort lieferbar
  • Zahlungsarten anzeigen

Learn Spring Boot and how to build Java-based enterprise, web, and microservice applications with it. In this book, you'll see how to work with relational and NoSQL databases, build your first microservice, enterprise, or web application, and enhance that application with REST APIs. You'll also learn how to build reactive web applications using Spring Boot along with Spring Web Reactive. Then you'll secure your Spring Boot-created application or service before testing and deploying it.

After reading and learning with Beginning Spring Boot 2, you'll have the skills and techniques to start building your first Spring Boot applications and microservices with confidence to take the next steps in your career journey.

What You'll Learn

  • Use Spring Boot autoconfiguration
  • Work with relational and NoSQL databases
  • Build web applications with Spring Boot
  • Apply REST APIs using Spring Boot
  • Cre
ate reactive web applications using Spring Web Reactive
  • Secure your Spring Boot applications or web services
  • Test and deploy your Spring Boot applications
  • Who This Book Is For

    Experienced Java and Spring Framework developers who are new to the new Spring Boot micro-framework.



    K. Siva Prasad Reddy is a Senior Software Engineer having more than seven years of experience in developing enterprise applications with Java and Java EE technologies. Siva is a Sun Certified Java Programmer and has a lot of experience in server-side technologies such as Java, Java EE, Spring, Hibernate, MyBatis, JSF, PrimeFaces, and WebServices (SOAP/REST).


    Learn Spring Boot and how to build Java-based enterprise, web, and microservice applications with it. In this book, you'll see how to work with relational and NoSQL databases, build your first microservice, enterprise, or web application, and enhance that application with REST APIs. You'll also learn how to build reactive web applications using Spring Boot along with Spring Web Reactive. Then you'll secure your Spring Boot-created application or service before testing and deploying it. After reading and learning with Beginning Spring Boot 2, you'll have the skills and techniques to start building your first Spring Boot applications and microservices with confidence to take the next steps in your career journey. What You'll Learn Use Spring Boot autoconfiguration Work with relational and NoSQL databases Build web applications with Spring Boot Apply REST APIs using Spring Boot Create reactive web applications using Spring Web ReactiveSecure your Spring Boot applications or web servicesTest and deploy your Spring Boot applications Who This Book Is For Experienced Java and Spring Framework developers who are new to the new Spring Boot micro-framework.

    K. Siva Prasad Reddy is a Senior Software Engineer having more than seven years of experience in developing enterprise applications with Java and Java EE technologies. Siva is a Sun Certified Java Programmer and has a lot of experience in server-side technologies such as Java, Java EE, Spring, Hibernate, MyBatis, JSF, PrimeFaces, and WebServices (SOAP/REST).

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

    Erscheint lt. Verlag 27.9.2017
    Zusatzinfo XX, 304 p. 28 illus., 27 illus. in color.
    Verlagsort Berkeley
    Sprache englisch
    Themenwelt Mathematik / Informatik Informatik Programmiersprachen / -werkzeuge
    Schlagworte application • Boot • Code • Enterprise • Framework • Java • micro • Open Source • Software • Spring • Web
    ISBN-10 1-4842-2931-2 / 1484229312
    ISBN-13 978-1-4842-2931-6 / 9781484229316
    Haben Sie eine Frage zum Produkt?
    PDFPDF (Wasserzeichen)
    Größe: 4,8 MB

    DRM: Digitales Wasserzeichen
    Dieses eBook enthält ein digitales Wasser­zeichen und ist damit für Sie persona­lisiert. Bei einer missbräuch­lichen Weiter­gabe des eBooks an Dritte ist eine Rück­ver­folgung an die Quelle möglich.

    Dateiformat: PDF (Portable Document Format)
    Mit einem festen Seiten­layout eignet sich die PDF besonders für Fach­bücher mit Spalten, Tabellen und Abbild­ungen. Eine PDF kann auf fast allen Geräten ange­zeigt werden, ist aber für kleine Displays (Smart­phone, eReader) nur einge­schränkt geeignet.

    Systemvoraussetzungen:
    PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
    eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
    Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.

    Zusätzliches Feature: Online Lesen
    Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.

    Buying eBooks from abroad
    For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

    Mehr entdecken
    aus dem Bereich
    Das umfassende Handbuch

    von Johannes Ernesti; Peter Kaiser

    eBook Download (2023)
    Rheinwerk Computing (Verlag)
    31,43
    Das Handbuch für Webentwickler

    von Philip Ackermann

    eBook Download (2023)
    Rheinwerk Computing (Verlag)
    34,93
    Deterministische und randomisierte Algorithmen

    von Volker Turau; Christoph Weyer

    eBook Download (2024)
    De Gruyter (Verlag)
    64,95