Q. How to handle errors in modern JAVA applications?
A. There is no single answer. But let’s dive into the possible options…
From time to time, we see a mixture of validation rules and exceptions throwing in a code base. But then again, what is a validation rule? It’s an ordinal response from an application. Hence, it is not an error and should not be treated as such. From a development point of view, errors must be flagged (thrown), while violations of business rules is ordinary data flow
An error is specific a application state in which following actions must…
Imagine You have a Spring application with two predefined profiles:
cloud— profile to run application inside Cloud infrastructure with extra configuration, beans etc…
local— profile to run application in local environment
If You run the application without a profile — it starts with the
default profile which configures the application in an inappropriate way.
Q: How do we prevent the application from running without any profile defined?
A: Create a custom
EnvironmentPostProcessor is a Spring initialization mechanism which allows
Environment to be configured before application initialization state.
This interface has only one method:
void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application);
The goal of this tutorial is to create a cloud-ready application based on Spring Cloud Stream and Apache Kafka (as a messaging system).
sudo apt-get install openjdk-8-jre
Apache Kafka contains of two main components:
To start you must sequentially execute the following commands: