Title Page Copyright and Credits Learn Spring for Android Application Development Dedication About Packt Why subscribe? Packt.com Contributors About the authors About the reviewers Packt is searching for authors like you Preface Who this book is for What this book covers To get the most out of this book Download the example code files Download the color images Conventions used Get in touch Reviews About the Environment Technical requirements Setting up the environment Spring Java Kotlin Apache Tomcat Configuring Tomcat Verifying Tomcat Integrated development environment IntelliJ IDEA Eclipse Android Summary Questions Further reading Overview of Kotlin Technical requirements Introduction to Kotlin Setting up the environment Build tools Basic syntax Defining packages Defining variables Defining functions Defining classes Object-oriented programming Functions Functional programming Declarative and imperative styles Extension functions Collections in Kotlin Higher-order functions Lambdas Control flow elements The if { ... } else { ... } expression The when { ... } expression Loops for loops while loops Ranges String templates Null safety, reflection, and annotations Null safety Reflection Annotations Summary Questions Further reading Overview of Spring Framework Technical requirements Introduction to Spring The advantages of Spring Spring Architecture Core containers Data Access/Integration Web  Aspect-oriented programming Instrumentation Test Configuring beans Spring configuration metadata XML-based configuration Bean scopes Singleton scope Prototype scope Bean life cycle Dependency injection Auto-wiring beans Annotation-based configuration The @Required annotation The @Autowired annotation The @Qualifier annotation Code-based configuration The @Configuration and @Bean annotations Dependency injection bean The @Import annotation Life cycle callbacks Creating a scope bean Spring MVC DispatcherServlet Creating a project Converting to a Maven project Spring MVC dependencies to pom.xml Creating Spring configuration beans Creating a controller class The view  IntelliJ Ultimate Eclipse SpringBoot  Creating a project Creating an application class Summary Questions Further reading Spring Modules for Android Technical requirements REST client module The RestTemplate module Gradle and Maven repository Gradle Maven RestTemplate constructors RestTemplate functions HTTP GET HTTP POST HTTP PUT HTTP DELETE HTTP OPTIONS HTTP HEAD Retrofit The use of Retrofit Advantages of Retrofit Configuring Retrofit Downloading Retrofit HTTP request functions GET PUT DELETE HEAD Creating an Android app Gradle information Gradle dependencies Creating a model Implementing a service Calling callback Creating an interface Mobile applications Summary Questions Further reading Securing Applications with Spring Security Technical requirements Spring Security architecture Authentication Modifying authentication managers Authorization Web security Method Security The advantages of Spring Security Spring Security features Spring Security modules Implementing Spring Security Maven Gradle Securing REST with basic authentication What is basic authentication? Creating a project Configuring pom.xml Configuring a Spring bean Configuration for Spring Security Configuring an authentication entry point Configuring Spring WebApplicationInitializer Creating a user model Creating a controller Using the HTTP client Creating an Android app Gradle information Gradle dependencies Creating a user model Implementing the user service Authenticating with OkHttp interceptors Calling callbacks Creating the UI Creating a custom list adapter Mobile applications Securing REST with Spring Security OAuth2 What is OAuth2? OAuth2 Roles OAuth2 grant types Creating a project Maven dependencies Configuring the resource server Configuring the authorization server Creating the security config Creating the controller class Creating the application class Application properties Checking the output Checking unprotected URLs Getting access tokens Accessing the protected URL Common mistakes and errors Summary Questions Further reading Accessing the Database Technical requirements Database Types of database Personal database Relational database Distributed database Object-oriented database NoSQL database Graph database Cloud database Database management system Data access in the Spring Java database connectivity in Spring Creating a sample project using JDBC Maven dependencies Creating DataSource Creating a table in database Creating a model Creating row mapper Creating an API interface Creating a user repository JdbcTemplate implementation Creating HTTP methods for RESTful APIs Create READ UPDATE DELETE Creating service Creating controller Autowired service Getting the user list Getting one user by ID Inserting a new user Updating a user Deleting a user  Testing the output Getting the user list Getting one user by ID Inserting a new user Updating a user Deleting a user  Java Persistence API Architecture of JPA Creating a project using JPA Maven dependencies Creating the DataSource Creating a model Creating a user repository Creating controller Autowired repository Getting the user list Getting one user by ID Inserting new user Updating a user Deleting a user  Seeing the output Database of client-side application Architecture components Creating an Android app Gradle information Gradle dependencies Creating entity Creating the DAO Creating the LiveData class Creating a Room database Populating the database Implementing the repository Creating the ViewModel Creating new activity Creating custom RecyclerView adapter Implementing RecyclerView Modifying main activity Getting data from another activity Adding XML layouts Switching another activity Run the app Summary Questions Further reading Concurrency Technical requirements Coroutines Coroutine basics Call stacks Coroutine testing Coroutine scope Channels The producer function The actor function Sequential operations Callback hell What is a callback? Thread pools Summary Questions Further reading Reactive Programming Technical requirements Reactive programming with Spring Reactor The Observer pattern The Flux publisher The filter operator The map operator The flatMap operator The reduce operator The from static method Cancellation The Mono publisher Blocking and non-blocking RxJava Flowable Observable The debounce operator The throttle operator Single Maybe Completable RxJava in Android The RxAndroid library The RxBinding library Summary Questions Further reading Creating an Application Technical requirements Project idea Server side Creating the design Developing a database model Creating a project Creating entities Creating a Profile entity Creating a Post entity Creating a Comment entity Creating like entity Creating repositories Creating a controller Creating a profile's HTTP requests Creating a post's HTTP requests Creating a comment's HTTP requests Implementing security Modified application.properties Client side Creating the design Creating a project Implementing dependencies  Creating HomeActivity Modifying the layout Creating models Creating profile model Creating post model Creating a comment model Creating services Creating the profile service Creating the post service Creating the comment service Creating an API service Creating a login activity Modifying the layout Modifying activity Login request Creating the registration activity Modifying layout Modifying the activity Registering a new profile  Modifying the main activity Modifying the layout Modifying the activity Fetching a post Submitting a post Implementing the menu Modifying the post adapter Modifying post adapter layouts Creating the adapter for posts Modifying the profile layout Modifying a profile activity Fetching the profile details Post details activity Modifying the post details layout Modifying the post details activity Fetching post details Submitting comment Modifying the comment adapter Checking the output Summary Questions Further reading Testing an Application Technical requirements Software testing JUnit Advantages of JUnit Basic annotations of JUnit Creating a project Test a project using JUnit  Creating a test case for a Rest API  UI testing on Android Espresso Creating an application Injecting dependencies Modifying the application Creating testing files Summary Questions Further reading Assessments Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Other Books You May Enjoy Leave a review - let other readers know what you think