Java


Quarkus
Introduction In this post I will show you how to serve a ReactJS (or any other JavaScript SPA) front-end application using a Java Quarkus Application as a back-end and static page server. The post also includes instructions on how to configure Maven to perform the front-end build tasks along with your application packaging. This article is very similar to my 2017 Angular + Spring Boot integration using Gradle blog post, with some added features to enable React’s router to work. Requirements The technology stack required for this example is: Node.js React Quarkus Maven The main goal is to achieve an […]

React + Quarkus integration using Maven


YAKC - Yet Another Kubernetes Client
Introduction Kubernetes v1.19.0 was just released. Amongst the many new features and improvements, the graduation of Ingress API to V1 (#1453) stands out. Despite users have widely adopted Ingress resources, and that Kubernetes introduced the beta feature back in 2015 (v1.1), it hasn’t been until the new v1.19 release that Ingress has gone GA. An Ingress is “An API object that manages external access to the services in a cluster, typically HTTP”. In other words, Ingresses are the way to publicly expose your Kubernetes managed Services to the outer world. In this post, I will show you how to use […]

Kubernetes 1.19 Ingress API from Java using YAKC


Quarkus
Introduction Quarkus provides its very own templating engine, Qute. In this post, I will show you how to use it to render Markdown from different sources using flexmark-java. Besides showcasing Qute, another reason for this post is to show complex assembly configurations to build container images using Eclipse JKube. I designed the project to be run in Kubernetes, so some of the features won’t be available if the application is run locally. The application renders a template with markdown fragments loaded from different locations, highlighting how these fragments can be assembled into the container image using different techniques and ultimately […]

Quarkus + JKube: Qute template with markdown processing from different ...



Camel
Introduction Eclipse JKube 1.0.0 GA will be released on September 9, 2020. As I mentioned in previous posts, JKube is the successor of the deprecated Fabric8 Maven Plugin (FMP), and as such, our main goal right now is to migrate the current user-base to the new project. Aligned with this strategy, we started to create Pull Requests on those repositories that are currently using FMP in order to replace the deprecated dependency. In this article, I’ll describe how to run the updated Apache Camel example (now using JKube) for Cassandra running on Kubernetes, and its expected behavior. This blog post […]

Apache Camel used on a Kubernetes Cassandra cluster


Quarkus
Introduction During the past few months, my team and I have been working very hard to release Eclipse JKube. JKube is the successor of the deprecated Fabric8 Maven Plugin, and as such, our main goal right now is to migrate the current user-base to the new project. GitHub provides some fancy stats and metrics, including information about the project’s dependency graph. This information is really valuable since we get to know which projects (within GitHub) depend on ours. So for our user-base migration use case, this information is spot on. Unfortunately, the GitHub developers API offers information about dependencies, but […]

Building a GitHub Dependents Scraper with Quarkus and Picocli


YAKC - Yet Another Kubernetes Client
Introduction This example shows how you can access the Kubernetes cluster’s REST API from inside a Pod using YAKC (Yet Another Kubernetes Client), Eclipse JKube and Spring Boot. The first part of the tutorial shows how to create a very simple Spring Boot application with the required YAKC Kubernetes Client dependency (see introductory post for YAKC). The second part describes how to quickly deploy the application into a Kubernetes cluster and how to perform requests to the Pod’s REST endpoints to retrieve information from the cluster. Example application The first step will be to create an example Spring Boot Maven […]

Access the Kuberntes API from a Pod in Java



YAKC - Yet Another Kubernetes Client
Introduction I’m a proud member of the team maintaining Fabric8 Kubernetes Client (for a while now) which is one of the most popular Java clients for Kubernetes and OpenShift. Fabric8 Kubernetes Client is great because it allows to perform most of the kubectl supported operations from Java with a very neat and fluent API. However, accessing low-level REST API operations or specific API versions is hard because some of these decisions are taken for you (for now). This is the main reason that drove me to implement Yet Another Kubernetes Client (YAKC) as a side project during these Easter holidays. […]

Kubernetes Client for Java: Introducing YAKC


Quarkus + GraalVM + Fabric8 Maven Plugin 2
Introduction In this tutorial, we’ll see how to develop and integrate a very simple Quarkus application with Fabric8 Maven Plugin in order to publish a native GraalVM image into Docker Hub. The first part of the tutorial describes how to build a very simple Quarkus application. The next part describes how to build a Quarkus native executable with GraalVM. The last section shows how to integrate the project with Fabric8 Maven Plugin and how to deploy the application images into Docker Hub. Quarkus example application This section describes how to build a simple application that will return a random quote […]

Quarkus + Fabric8 Maven Plugin + GraalVM integration


Test Pyramid
Introduction In this post we’ll see how to use MockMvc to test Spring endpoints. This is the first post of a series, this post will highlight the advantages of using Spring MVC test framework compared to other ways of testing controller classes and what are the different ways to setup your tests. You can find the source code for this post at GitHub. The project contains a regular MVC controller that forwards requests to a static resource, and two rest controllers that return a list of languages and coffees. MockMvc and the test pyramid In his book, Succeeding with Agile: […]

MockMvc – Spring MVC testing framework introduction: Testing Spring endpoints



1
Introduction This is the second post on the series about Spring Bean Scopes. In the previous tutorial we saw that there were issues rising when a Prototype scoped Bean was injected in a Singleton scoped Bean. The main problem is that autowired Prototypes will be injected when the Singleton Bean is instantiated (which happens only once) thus even though they are prototypes in reality they’ll behave as singletons. The next code highlights this behavior: [crayon-5f68801e17e02518985030/] In the previous example, although the object requested with getAutowiredSample is defined with a Prototype scoped Bean, the instance of the object returned in both […]

Spring Bean Scopes: Singleton with Prototypes


Introduction This tutorial shows the different scopes you can assign to a Bean or a Component in Spring Framework. It’s important to understand that a Bean definition is just a recipe to create instances of a class following the definition of this recipe. This recipe can be then used one or more times during the life cycle of the application to create an instance of the Bean. The Bean scope is one of the main characteristics of the Bean configuration in Spring. The scope will indicate when and how is the object for the Bean definition going to be instantiated. […]

Spring Bean Scopes: Guide to understand the different Bean scopes


Java 10
Introduction As you probably already know, Java 10 was released the past 20th of March following the new tight six-month release schedule. This version comes just after the Java 9 release on September 2017 and marks this past release obsolete. Same will happen to Java 10 on September this year, when the release of Java 11 will mark this one obsolete. Java 11 will be released as a long term support (LTS) version and will have a much longer lifespan, but until then, let’s take a look at some of the new features in Java 10. Time-Based Release Versioning Java […]

Java 10: Testing the new release