Spring Boot CommandLineRunner — Run logic at startup ⚡ Want to execute code after app starts? Use this 👇 @Component public class StartupRunner implements CommandLineRunner { @Override public void run(String... args) { System.out.println("App Started!"); } } 💡 Use cases: ✔ Preload data ✔ Validate configs ✔ Initialize resources ⚠️ Mistake: Putting heavy logic → slows startup ❌ 👉 Keep it lightweight Startup logic should be fast & clean 🚀 #SpringBoot #Java #BackendDeveloper
Spring Boot CommandLineRunner for Startup Logic
More Relevant Posts
-
Circular dependencies in Spring Boot can quietly break your app at startup. When DepositService depends on PaymentService and PaymentService depends back on DepositService, Spring Boot 2.6+ will fail with BeanCurrentlyInCreationException. That’s because circular dependencies are now prohibited by default. Why it fails Spring can’t fully create either bean because each one needs the other first. This creates a startup deadlock instead of a clean dependency graph. Best fix Refactor the design. Move shared logic into a third service so the dependency flow becomes one-way, not circular. This is the most maintainable solution. Other options Use @Lazy to inject a proxy and delay bean creation. Use setter injection as a last resort when you must break the creation cycle. Takeaway If you hit a circular dependency, treat it as a design smell, not just a Spring error. Fix the architecture first, and only use framework-level workarounds when absolutely necessary. #SpringBoot #Java #SpringFramework #BackendDevelopment #SoftwareEngineering #TechTips #Programming #CleanCode #Microservices #SoftwareDeveloper #TechCommunity #DeveloperTools #CircularDependency #DependencyInjection #LinkedInTech #Coding #Debugging #SystemDesign #C2C #C2CJobs #C2CRecruiting #C2CContract #ContractJobs #ITRecruitment #TechHiring #USJobs #JobSearch #HiringNow
To view or add a comment, sign in
-
-
🚨 Ever wondered what actually happens when a Spring Boot app starts? Most developers just run the app and move on. But understanding this helped me debug startup issues faster. Here’s the simplified flow 👇 Spring Boot initializes the ApplicationContext Auto-configuration kicks in (based on classpath) Beans are created and wired Embedded server (Tomcat) starts Application is ready to serve requests 💥 Real issue I faced: A misconfigured bean was slowing startup by ~20 seconds. Root cause? Unnecessary component scanning + heavy initialization logic inside a bean. ✅ Fix: Reduced scan scope Moved heavy logic to lazy initialization 💡 Takeaway: Startup time matters more than you think in microservices. Have you ever debugged a slow Spring Boot startup? #Java #SpringBoot #BackendDevelopment #SoftwareEngineering #Microservices #RESTAPI #SystemDesign #DeveloperLife #100DaysOfCode
To view or add a comment, sign in
-
Do you also think building apps is complicated? Setting up everything… connecting pieces… making it all work together. But what if you could just focus on your idea? That’s what Spring Boot does. It takes care of the heavy lifting in the background, so you can build faster, with less stress - and actually enjoy the process. Think less setup. More building. 🚀 #SpringBoot #Java #BackendDevelopment #SoftwareEngineering #CleanCode #DeveloperLife
To view or add a comment, sign in
-
-
💻 90% of being a developer is just… Googling 😅 Let’s be honest 👇 We don’t always write code from scratch… We search, test, break, fix… repeat 🔁 And somehow… it works 🚀 But that’s the beauty of development: 👉 It’s not about knowing everything 👉 It’s about finding solutions faster Every bug teaches something Every error makes you sharper So next time your code breaks… Just remember — you're not stuck, you're learning 😉 #DeveloperLife #CodingHumor #ProgrammerLife #TechLife #WebDevelopment #AppDevelopment #Debugging #CodeLife #Developers #StartupLife
To view or add a comment, sign in
-
-
💻 90% of being a developer is just… Googling 😅 Let’s be honest We don’t always write code from scratch… We search, test, break, fix… repeat 🔁 And somehow… it works 🚀 But that’s the beauty of development: It’s not about knowing everything It’s about finding solutions faster Every bug teaches something Every error makes you sharper So next time your code breaks… Just remember — you're not stuck, you're learning #DeveloperLife #CodingHumor #ProgrammerLife #TechLife #WebDevelopment #AppDevelopment #Debugging #CodeLife #Developers #StartupLife
To view or add a comment, sign in
-
-
You’re Only Using 20% of Spring Boot… And That’s the Catch #Java #SpringBoot #Microservices #BackendDevelopment #SoftwareEngineering #CleanCode #Programming #Developers #Coding #Tech #JavaDeveloper #SystemDesign #Debugging #Architecture #Spring “You use 20% of Spring Boot… But it quietly solves 80% of your backend problems.” The real question is : Do you know which 20% is being used… and what the other 80% is doing behind the scenes ? Because the day it breaks - • it’s no longer debugging code. • It’s debugging Spring itself. Example : • Add one starter → App runs. • Override one config → Everything stops working. Spring Boot feels simple… until it needs to be understood. Behind every “simple” app… there’s hidden complexity waiting to be uncovered. Understand what most developers use… but very few truly understand. "𝗕𝗲𝘆𝗼𝗻𝗱 𝗦𝘆𝗻𝘁𝗮𝘅" Follow to understand the 80% of Spring Boot most developers never see.
To view or add a comment, sign in
-
Kotlin Flow Operators — Deep Dive (Android) Most developers use Flow… 👉 but only a few truly understand its power. Flow is not just about async streams — it’s about handling data efficiently, safely, and at scale. 🧠 What makes Flow powerful? ✔ Declarative data streams ✔ Built-in backpressure handling ✔ Structured concurrency ✔ Easy composition of async operations 🔍 Key Operator Categories 🔹 Creation → flow, flowOf, callbackFlow 🔹 Transformation → map, mapLatest, transform 🔹 Filtering → filter, take, distinctUntilChanged 🔹 Combination → combine, zip 🔹 Flattening → flatMapLatest ⭐ (most used) 🔹 Backpressure → debounce, sample 🔹 Threading → flowOn 🔹 Performance → buffer, conflate, collectLatest 🔹 Terminal → collect, first, toList 🔹 Error Handling → catch, retry 🔹 Lifecycle → stateIn, shareIn ⚡ Real-World Example searchQueryFlow .debounce(300) .distinctUntilChanged() .flatMapLatest { query -> repository.search(query) } .collectLatest { result -> showResult(result) } 👉 Flow = Cold streams + cancellation + backpressure + concurrency 💡 Why mastering Flow matters? ✔ Better performance ✔ Cleaner architecture ✔ Scalable async handling 🔥 Final Thought “Good Flow usage is invisible when done right, but painful when ignored.” #Android #Kotlin #KotlinFlow #Jetpack #Compose #AndroidDev #CleanArchitecture #MobileDevelopment #SoftwareEngineering #AppDevelopment #AndroidStudio #MVVM #Coroutines #AsynchronousProgramming #Tech #Developers #Programming #CodeNewbie #CodingLife #AndroidArchitecture #SystemDesign #ScalableSystems #OfflineFirst #PerformanceOptimization #UIEngineering #DevCommunity
To view or add a comment, sign in
-
-
🚀 Docker in 5 Minutes: A Beginner-Friendly Example 🐳 If Docker still feels confusing, here’s the simplest way to understand it 👇 Let’s say you have a Node.js app. Instead of asking someone to install Node, npm, dependencies… you just give them this: 📦 Dockerfile FROM node:18 WORKDIR /app COPY . . RUN npm install CMD ["npm", "start"] Now run: 👉 docker build -t my-app . 👉 docker run -p 3000:3000 my-app 💥 That’s it. Your app runs anywhere — no setup drama. 🧠 Why this matters: No “works on my machine” problem Same environment for everyone Faster onboarding for teams 📌 Next step: Learn docker-compose to run full stacks (DB + backend + cache) 💬 Want me to share a real-world docker-compose example next? #Docker #DevOps #Programming #Developers #SoftwareEngineering
To view or add a comment, sign in
-
I've been building software for 5 years. Full-stack. React, Django, Express, and more. Teaching to 100+ Students Frontend, Backend, DevOps I've built: - A pharmacy management system - A platform called ShowPageMe - Tailors Ordering Management System - Browser OS experiences With React - Game prototypes in Godot - Animating Animations in Moho - and some not public platforms and solutions But here's the thing - I never posted about any of it. That changes today. I'm a developer from Afghanistan, and I'm going to start sharing what I build, what I learn, and what I struggle with. Follow along if you're into real dev stories. #SoftwareDevelopment #BuildInPublic #FullStackDeveloper
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development