When building applications with Micronaut, we often need to execute some logic when the application starts. This could include tasks like initializing resources, seeding a database, or logging system information. In this article, we will explore how to run startup code in Micronaut using ApplicationEventListener and @EventListener. Table of contents 1. Implements ApplicationEventListener to Run […]

Read more How to Run Startup Code When Micronaut Starts

This article shows different ways to run a CommandLineRunner bean conditionally in a Spring Boot application. Table of contents: 1. Using @ConditionalOnProperty 2. Using Environment 3. Using Spring Profiles 4. Check the Presence of Other Beans 4.1 Using @ConditionalOnBean 4.2 Using @ConditionalOnMissingBean 5. Download Source Code 6. References P.S. Tested with Spring Boot 3.1.2 1. […]

Read more How to Run a CommandLineRunner Bean Conditionally in Spring Boot

This article tells what is CommandLineRunner and different ways of implementing it or use it in Spring Boot. Table of contents: 1. What is CommandLineRunner? 2. Implementing CommandLineRunner 3. @Bean CommandLineRunner 4. Download Source Code 5. References P.S. Tested with Spring Boot 3.1.2 1. What is CommandLineRunner? The CommandLineRunner is an interface in Spring Boot. […]

Read more Spring Boot CommandLineRunner Example