Tagged articles
CommandLineRunner
21 articles · Page 1 of 1
This tutorial demonstrates how to implement Redis cache preheating in Spring Boot using an abstract cache class, ApplicationContextAware utility, and CommandLineRunner to automatically load hot data on startup, with a complete NewsCache example using RedisTemplate.
AbstractCacheApplicationContextAwareCache Preheating
0 likes · 6 min read

This article demonstrates how to implement Redis cache warming in Spring Boot using an abstract cache class, ApplicationContextAware utility, and CommandLineRunner to preload hot data at startup, with a concrete NewsCache example showing RedisTemplate integration and automatic cache reload on expiration.
Cache PreheatingCache WarmingCommandLineRunner
0 likes · 6 min read

This article explains cache preheating concepts and demonstrates a complete Spring Boot implementation using an abstract cache class, ApplicationContext utility, CommandLineRunner for startup loading, and a concrete NewsCache example with RedisTemplate to load hot data at startup, reducing cache penetration and database load.
ApplicationContextAwareCache PreheatingCaching
0 likes · 6 min read

This article explains the concept of cache preheating, provides an abstract cache class, a Spring context utility, and a CommandLineRunner implementation that automatically loads hot data into Redis at startup, demonstrating the approach with a news‑cache example and related controller code.
AbstractCacheCache PreheatingCommandLineRunner
0 likes · 5 min read

The article explains four ways to preheat caches in Spring during startup, recommends CommandLineRunner/ApplicationRunner as the safest option, and discusses timing, async handling, error protection, and distributed‑lock strategies to avoid common pitfalls in production environments.
CommandLineRunnerInterviewSpring
0 likes · 13 min read

This article presents ten highly valuable Spring Boot features—including global exception handling, MVC interceptors, programmatic bean access, @Import usage, startup runners, BeanDefinition modification, bean lifecycle callbacks, and custom scopes—each illustrated with concrete code examples and explanations for building cleaner, more maintainable Java backend applications.
BeanFactoryCommandLineRunnerCustom Scope
0 likes · 13 min read

This article explains eight ways to execute custom initialization logic during Spring Boot startup, covering CommandLineRunner, ApplicationRunner, ApplicationListener, @EventListener, @PostConstruct, BeanPostProcessor, InitializingBean, SmartInitializingSingleton, and the main method, with code examples and suitable use‑case guidance.
BeanPostProcessorCommandLineRunnerPostConstruct
0 likes · 10 min read

This article explains the purpose of Spring Boot's ApplicationRunner and CommandLineRunner interfaces, demonstrates common startup tasks such as data initialization, configuration loading, cache population and license verification, compares their parameter handling, shows how to control execution order with @Order, and reveals the internal call chain that Spring uses to invoke these runners.
ApplicationRunnerCommandLineRunnerInitialization
0 likes · 15 min read

This guide explains why pre‑loading initial data is essential for Spring Boot applications and demonstrates four practical methods—CommandLineRunner/ApplicationRunner, bean initialization with @PostConstruct, SQL script execution, and @Sql annotation for tests—complete with code snippets and configuration details.
CommandLineRunnerData InitializationSQL Scripts
0 likes · 8 min read

This article explains the concept of cache preheating, provides an abstract cache class, a Spring ApplicationContext utility, a CommandLineRunner handler to load hot data at startup, and demonstrates a concrete NewsCache implementation with Redis integration, followed by a REST endpoint to access the cached data.
AbstractCacheCommandLineRunnerJava
0 likes · 8 min read

This guide explains how to run custom code after SpringApplication starts by implementing ApplicationRunner or CommandLineRunner, compares their method signatures and argument handling, shows execution timing, provides practical examples, and demonstrates how to control execution order with @Order or Ordered.
ApplicationRunnerCommandLineRunnerRunner
0 likes · 7 min read

This article provides a deep technical analysis of Spring Boot's startup process, explains every relevant extension point, demonstrates how to log and verify execution order with sample code, answers eleven common questions about bean initialization, and offers practical guidance on when to safely open RPC, MQ, and HTTP traffic.
@AutowiredBean LifecycleCommandLineRunner
0 likes · 17 min read

This article explains the core principles of Spring Boot startup configuration, demonstrates how to intervene using ApplicationContextInitializer, SpringApplicationRunListener, ApplicationRunner, and CommandLineRunner, and provides practical optimization techniques to significantly reduce application launch time.
ApplicationRunnerBackendCommandLineRunner
0 likes · 32 min read

This article explains the various ways to execute code during a Spring Boot application's startup, comparing Java static blocks, constructors, @PostConstruct methods, and Spring's ApplicationRunner and CommandLineRunner interfaces, including ordering with @Order and providing sample code and execution results.
ApplicationRunnerCommandLineRunnerJava
0 likes · 5 min read

This article explains six practical techniques for executing custom logic during Spring Boot startup, covering ApplicationListener events, CommandLineRunner, ApplicationRunner, @PostConstruct, @Bean initMethod, and InitializingBean, with code examples and brief analysis of each approach.
ApplicationRunnerCommandLineRunnerPostConstruct
0 likes · 10 min read

This article explains the differences between Spring Boot’s CommandLineRunner and ApplicationRunner, illustrates common pitfalls when using CommandLineRunner—such as blocking startup and causing exceptions—and shows how to run tasks in a separate thread to avoid startup failures.
ApplicationRunnerCommandLineRunnerMultithreading
0 likes · 9 min read

This article explains several Spring Boot techniques for initializing resources at application startup, including CommandLineRunner, ApplicationRunner, @Order, @PostConstruct, InitializingBean, and ApplicationListener, and provides code examples and usage guidelines for each method.
ApplicationRunnerCommandLineRunnerInitializingBean
0 likes · 8 min read

This article explains various ways to execute custom logic during Spring container startup, covering bean constructors, @PostConstruct, InitializingBean, ApplicationListener events, @EventListener, constructor injection, CommandLineRunner, and SmartLifecycle, with code examples and usage guidelines.
Bean InitializationCommandLineRunnerJava
0 likes · 10 min read

This article explains the five ways Spring Boot can execute code during application startup—including CommandLineRunner, ApplicationRunner, ApplicationListener, @PostConstruct, and InitializingBean—detailing their usage, ordering, argument parsing, and best‑practice recommendations.
ApplicationRunnerCommandLineRunnerJava
0 likes · 12 min read

This guide explains how to build a Spring Boot starter that automatically counts and logs the number of entries for each entity at application startup, covering starter concepts, Maven setup, code implementation, auto‑configuration, and integration into a main project.
CommandLineRunnerMavenSpring Boot
0 likes · 8 min read

This article explains the new ApplicationStartedEvent introduced in Spring Boot 2.0, shows the full event order, demonstrates how to write listeners for ApplicationPreparedEvent, ApplicationStartedEvent and ApplicationReadyEvent, and clarifies the difference between ApplicationStartedEvent and ApplicationReadyEvent using a CommandLineRunner example.
ApplicationStartedEventCommandLineRunnerJava
0 likes · 9 min read
