Date : 2022-12-12 5.57 PM
WordPress post content not showing…

Read more to see the solution<!– .*
Date : 2022-12-12 5.57 PM
WordPress post content not showing…
Read more to see the solution<!– .*
Spring auto-configuration can be tricky when it comes to conditional based bean creation. The best way to ensure the proper application context is through meticulous testing.
Spring Boot 2.X provides some test helpers for easily configuring an ApplicationContext to simulate auto-configuration test scenarios.
Utility design to run an ApplicationContext and provide AssertJ style assertions. The test is best used as a field of a test class,
Let’s try this with a use case,
Let’s assume the application consists of multiple features and these features are toggled ( bean creation ) by environment configuration-based conditions,
All the features of the application are defined as an enum
and the enum contains a code and the application configuration itself. For simplicity let’s consider an app with 3 features.
public enum AppHubFeature { | |
LOGISTIC_UNIT_UPDATE("Logistic Unit Update", FeatureConfig.LOGISTIC_UNIT_UPDATE), | |
ORDER_STATUS_UPDATE("Order Status Update", FeatureConfig.ORDER_STATUS_UPDATE), | |
STOCK_ADJUSTMENT("Stock Adjustment", FeatureConfig.STOCK_ADJUSTMENT); | |
public static class FeatureConfig { | |
public static final String LOGISTIC_UNIT_UPDATE = "app-hub.feature.logistic-unit-update"; | |
public static final String ORDER_STATUS_UPDATE = "app-hub.feature.order-line-status-update"; | |
public static final String STOCK_ADJUSTMENT = "app-hub.feature.stock-adjustment"; | |
} | |
public final String feature; | |
public final String config; | |
AppHubFeature(String feature, String config) { | |
this.feature = feature; | |
this.config = config; | |
} | |
public String config() { | |
return this.config; | |
} | |
public String feature() { | |
return this.feature; | |
} | |
} |
Windows Subsystem for Linux (WSL) 2 provides a seamless Linux integration with many features. As developers, we can take full advantage of both OS at the same time.
For this example, I am using a Spring Boot project located in windows and run the project on a WSL2 Linux environment.
Continue readingLog4j22 provides multiple ways of creating a custom layout for many requirements. This article will explain simple ways to implement custom layouts using log4j2 plugins
In Log4j 2 a plugin is declared by adding a @Plugin annotation to the class declaration. During initialization, the Configuration will invoke the PluginManager to load the built-in Log4j plugins as well as any custom plugins.
We can use both AbstractStringLayout
or LogEventPatternConverter
according to our requirements. Both options will provide a way to access log4j LogEvent
that has all the relevant details about the log event to be customized.