Webpack ReactJS Gatsby
Introduction Gatsby is static site generator platform based in ReactJS and powered by GraphQL. I’ve been using Gatsby for a while now and most recently used it to rebuild my personal homepage. One of the things that has come to my attention is that transpiled Javascript source maps are published to production builds by default in V2. It’s nice to be transparent and to publish your source code and share with the software community, but maybe this is an undesirable effect (especially when building commercial websites). In this post we’ll see how we can configure Gatsby to publish source maps […]

Gatsby: Disable source maps in production


react webpack babel sass mn
Introduction Babel 7 comes after more than 2 years of active development and four thousand commits. The main advantage of the new version is the speed optimizations and configuration flexibility. In this tutorial we’ll see how to upgrade our React boilerplate application to support Babel 7. Bebel dependencies The first step in order to support Babel 7 is to replace our old dependencies in package.json: [crayon-5d586ddeec924902573123/] with new ones: [crayon-5d586ddeec92f566660425/] The main change compared to the older version is Babel’s switch to scoped packages. To summarize, from now on most of the packages named with the prefix babel- will now be named […]

React: Babel 7 support in boilerplate application


Isotope Mail Client
Introduction Isotope mail client is a free open source webmail application built with a microservice architecture vision in mind. As of now, the application is just an MVP offering the basic functionalities of any standard webmail client. The main purpose of this application is to personally expose, explore and learn new technologies, and development and design patterns. However, the application should be fully functional and solve many of the problems that other mail clients face. Features No database required Quick and easy deployment (docker images and deployment examples available) Rich text message editing Support for embedded images (paste into editor) Recipient […]

Isotope Mail Client: Introduction and features



react webpack babel sass mn 3
Introduction In this tutorial we’ll see how to build from scratch a React application with Webpack, Babel and Sass. The main requirement for this tutorial is to have a node installation with npm for your platform/OS. The tutorial is structured in several parts: Create an initial project directory Webpack setup Babel setup React Add support for Sass styles Initial project The first step is to create an initial empty project. For that purpose we’ll create an empty directory for the project and run the following command: [crayon-5d586ddeed7c4830301800/] This command will set up a new package.json file containing metadata for an […]

React : Babel + Webpack + Sass boilerplate application


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


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-5d586ddeefe8b281534235/] 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


Java 8 Streams
Introduction In this post we’ll see how to use Java Streams introduced in Java 8 to obtain a Map from a List. Maps are data structures composed of a collection of key-value elements such that a key is unique within the collection. This allows us to perform searches to find an element with a given key really quickly, without the need to iterate through the full collection. It’s a really common situation that when we have to solve a problem where the start point is a list of elements, we need to convert this list to a map so that […]

Java 8 Streams: Convert List into Map



Spring-Data + MongoDB 2
Introduction Spring Data makes really quick and easy the process of working with data entities, offering a specific implementation for MongoDB. You can merely define queries by creating interfaces with methods following a naming convention or annotating them with @Query and Spring will automagically generate an implementation for you. Most of the times this is enough for simple CRUD and query operations and there is no need to define additional methods. This will allow you to get up and running really quickly avoiding to type boilerplate code. However, there are many times where this is not enough and the repository […]

Spring Data MongoDB: Custom repository implementation


2
Introduction When running a static code analysis tool or inspecting/analyzing your code from your IDE, you may have encountered the following warning regarding your @Autowired fields: Field injection is not recommended This post shows the different types of injections available in Spring and what are the recommended patterns to use each of them. Injection types Although current documentation for spring framework (5.0.3) only defines two major types of injection, in reality there are three; Constructor-based dependency injection Setter-based dependency injection Field-based dependency injection The latter is the one which the static code analysis tool complains about, but is regularly and […]

Field injection is not recommended – Spring IOC


docker as a linux systemd service
Introduction There are many different ways to orchestrate docker container management, initialization, deployment, etc. Even Docker brings its own vanilla tool and mode. There are also many other third party container orchestration tools such as Kubernetes, Rancher, Apache Mesos, etc. Docker daemon offers simple means to start, stop, manage and query status of deployed containers. In this post we’ll cover how to use a docker + systemd only approach to deploy containers as Linux services without the need for third party tools or complex deployment descriptors. In this tutorial we will show how to deploy Portainer as a Linux systemd […]

Docker container as a Linux system service