REST Calls using Retrofit

Retrofit is a HTTP client for Android and Java, it turns your HTTP API into a Java interface. This time I will show you how to create a basic project using Retrofit. Setup Create a new project in android studio with no Activity, default options and set the following dependencies in build.gradle.kts implementation("com.squareup.retrofit2:retrofit:$retrofitVersion") implementation("com.squareup.retrofit2:converter-gson:$retrofitVersion") Here we are using Gson converter to transform the JSON responses to the model classes. In this example we are going to use a Fruitypedia API to get smoothie categories: https://fruitypedia. [Read More]

Android

Android is the most popular mobile operating system in the world, also Android is growing and spreading it lands on more devices and in more people’s awaiting hands.

With every mobile comes version and a numerical code a name that’s themed between sweets and desserts, running in alphabetical order.

alt

Here you can find some important topics regarding to Android development:

Return to the main article

Spring Webflux WebSockets

WebFlux contains support for reactive HTTP and WebSocket clients. WebSockets allows communication in both directions and this could happen simultaneusly, therefore WebSockets are the best way to deliver real time data bi-direactional using both text or binary content. This time we will review how to build a WebFlux application using WebSockets from both client and server. If you want to know more about how to create Spring Webflux please go to my previous post getting started with Spring Webflux here. [Read More]

Spring Webflux Constructor Injection

Lombok is a great tool to avoid boilerplate code, this time we will show you how to do constructor injection using Lombok in a Spring Webflux application. If you want to know more about how to create Spring Webflux please go to my previous post getting started with Spring Webflux here. Then, let’s create a new Spring Boot project with Webflux as dependencies: spring init --dependencies=webflux,lombok --build=gradle --language=java spring-webflux-required-args-constructor Here is the complete build. [Read More]

Spring Webflux JAXB

In this technical post we will take a look at how to produce XML using JAXB Jakarta EE implementation. Java Architecture for XML Binding (JAXB) provides an API and tools that automate the mapping between XML documents and Java objects. NOTE: If you need to know what tools you need to have installed in your computer in order to create a Spring Boot basic project, please refer my previous post: Spring Boot. [Read More]

Spring Boot XML Schema

XML is still the most sophisticated format for distributed data, when you have complete control between your clients and services JSON is the king, but if not, you probably will need to deal with XML, and there is for good reasons: XML is a W3C standard XML can be validated using Schemas XML embraces extensibility Supports multilingual documents Can embed multiple data types All those reasons are important, but most important is that we can validate any XML using XSD Schemas, in this technical post we will see how to generate Java classes using XSD eschemas with JAXB2 and Spring Boot. [Read More]

Spring Webflux Webclient Headers

HTTP headers allow the client and the server to pass additional information with the request or the response, if you want to know more about the list we can use as Http headers, please go here. In this technical post we will see how to validate a server response including their headers using WebTestClient. If you want to know more about how to create Spring Webflux please go to my previous post getting started with Spring Webflux here. [Read More]

Spring Webflux URI Validator

Spring Framework Validated Is designed for convenient use with Spring’s JSR-303 and allows to express and validate application constraints, in this technical post we will see how to validate a path variable using Spring Validated annotation in a Spring Webflux application, if you want to know more about how to create Spring Webflux please go to my previous post getting started with Spring Webflux here. Then, let’s create a new Spring Boot project with Webflux and Lombok as dependencies: [Read More]

Spring Boot H2

In this technical post we will review how to integrate an H2 in memory database in a Spring Webflux application. Please read this previous Spring Webflux Basics before conitnue with this information. Then, let’s create a new Spring Boot project with Webflux, Lombok, JPA and H2 as dependencies: spring init --dependencies=webflux,lombok,jpa,h2 --language=java --build=gradle spring-boot-h2 Here is the complete build.gradle file generated: plugins { id 'org.springframework.boot' version '2.1.4.RELEASE' id 'java' } apply plugin: 'io. [Read More]

Spring Boot Server-sent Events Client

In this technical post we will see how to consume events using Sever-sent events in a Spring Webflux application. Please read this previous Spring Boot Server-sent Events before conitnue with this information. Then, let’s create a new Spring Boot project with Webflux and Lombok as dependencies: spring init --dependencies=webflux,lombok --language=java --build=gradle spring-boot-sse-client Here is the complete build.gradle file generated: plugins { id 'org.springframework.boot' version '2.3.4.RELEASE' id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'java' } group = 'com. [Read More]