In the disruptive world, business wants to experiment a feature for a time period in production, operational team inspect a feature with resource consumption, developers want to be up to date with trunk branch while their development spans for a long time. How all this happen and still application/product works without any hassles?
It can be solved by toggle points protected and accessed on demand which is called feature flags. To know more about, refer RefCard. Instead of many hanging custom made code, if we have library which can organize all the flags horizontally across the software it will be easy. So Togglz does that!
Togglz is an implementation of the Feature Toggles pattern for Java. It is easy to maintain the feature flags in agile development of continuous delivery practices. All the feature states are configured on one location and feature flags incorporated on the implemented places. State of a feature flags can be activated (enabled) or inactive(disabled) by a properties. It can also be done by activation strategy, like when this condition meets, activate the flag.
Togglz ships with the following default strategies:
The strategies are easily understandable from their names, if any details required, it hyperlinks to the actual togglz documentation. We can develop our own custom strategies for activation by implementing the interface ActivationStrategy. Togglz does the service loader mechanism for activation. To do that, we need to register implementation by creating the file called META-INF/services/org.togglz.core.spi.ActivationStrategy which tells the fully qualified implementation class.
Feature State repositories can be maintained in-memory, properties file based, jdbc for rdms databases, monogo databases. We can also add caching state for these repositories. One more thing, togglz requires user information to toggle based on users, so user provider to be configured with Togglz.
#java #tutorial #integration #springboot #feature flags #togglz
#spring boot #spring boot tutorial #interceptor #interceptors #spring boot interceptor #spring boot tutorial for beginners
As an extension of the Spring Framework, Spring Boot is widely used to make development on Spring faster, more efficient and convenient. In this article, we will look at some of the parameters were using Spring Boot can drastically reduce the time and effort required in application development.
#full stack development #spring #spring and spring boot #spring boot
Integration tests play a key role in ensuring the quality of the application. With a framework like Spring Boot, it is even easier to integrate such tests. Nevertheless, it is important to test applications with integration tests without deploying them to the application server.
Integration tests can help to test the data access layer of your application. Integration tests also help to test multiple units. For the Spring Boot application, we need to run an application in
ApplicationContext to be able to run tests. Integration tests can also help in testing exception handling.
For this demo, we will build a simple Spring Boot application with REST APIs. We will be using the H2 In-Memory database for storing the data. Eventually, I will show how to write an integration test. This application reads a JSON file of vulnerabilities from the National Vulnerability Database and stores it in the H2 database. REST APIs allow a user to fetch that data in a more readable format.
#java8 #spring-boot-2 #integration-testing #springboottest #spring-framework #integration testing in spring boot application
In the video below, we take a closer look at the How to configure log4j2 in the Spring boot application using log4j2.xml? | Spring Boot logging. Let’s get started!
#java #spring boot #video #log4j #spring boot tutorial #spring boot tutorial for beginners
Most of the time, dependency injection is the first thing that comes to mind whenever the concept of inversion of control is brought up. For this article, I’d like to shed some light on method invocation as well, which is the concept being heavily utilized by Spring Integration.
Before diving into the code, let’s first talk about the types of coupling inversion of control solves: type-level coupling and system-level coupling.
Type-level coupling is probably the most understood — it’s coupling between types, and it’s solved by using dependency injection. I bet most of you know this already, but let me include an example below demonstrating the concept for clarity.
Suppose we have an
OrderService class, and it’s being instantiated in other classes.
#java #spring-boot #programming #spring-integration #spring