🚀 Day 17/100: Spring Boot From Zero to Production Topic: Activating Profiles in Spring Boot -> Why Activation Matters Creating profiles isn’t enough You need to activate them to use their config Otherwise, Spring Boot falls back to the default profile. -> Method 1: JVM Argument Pass this when running your app: -Dspring.profiles.active=dev Common for: Local development Switching configs quickly Loads application-dev.yaml -> Method 2: Environment Variable Set: SPRING_PROFILES_ACTIVE=dev Best for: Production environments CI/CD pipelines -> Default Behavior No active profile? default gets loaded Others are ignored Quick Insight Profiles = Config separation Activation = Making them work Simple concept. Powerful impact. This might sound simple but stay consistent. We’re building production mindset step by step. #Java #SpringBoot #SoftwareDevelopment #100DaysOfCode #Backend
Activating Spring Boot Profiles for Production
More Relevant Posts
-
🚨 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
-
-
Your API is slow. But your code looks fine. Common Spring Boot issue: N+1 queries. 1 query for parent • N queries for children Suddenly: • More DB calls • Higher latency • Poor performance Fix: • Use JOIN FETCH • Use DTO projections • Monitor queries Spring Boot didn’t slow your app. Your data access did. #SpringBoot #Java #Performance #Backend #SystemDesign #Debugging
To view or add a comment, sign in
-
-
A lot of backend bugs come from systems assuming requests happen only once. In theory, a request happens once. In production, it often happens: - twice - three times - after timeout - after retry - after partial failure That’s why idempotency is one of the most important backend design concepts. Typical examples: - payment retries - order submission retries - webhook processing - stock reservation - asynchronous consumers If your system can’t safely handle repeated operations, you eventually get: - duplicate orders - duplicate charges - incorrect inventory - inconsistent state The best systems are not the ones that never fail. They’re the ones that fail without corrupting business state. #Backend #DistributedSystems #Java #SpringBoot #SystemDesign #SoftwareEngineering
To view or add a comment, sign in
-
-
🚀 Day 18/100: Spring Boot From Zero to Production Topic: Auto-Configuration 💡 What is Auto-Configuration? One of the most powerful features in Spring Boot Turns hours of setup into minutes Eliminates heavy XML configs and manual bean wiring ⏳ Before Auto-Configuration Manually define multiple beans Write hundreds of lines of XML Configure everything yourself → painful ⚙️ What Happens Now? Your @SpringBootApplication kicks things off Spring Boot scans the classpath Looks for dependencies like: spring-webmvc spring-data-jpa 👉 Presence/absence of JARs = signals 🧠 Behind the Scenes Reads a special file: META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports Contains hundreds of auto-config classes Each uses conditions like: @ConditionalOnClass @ConditionalOnMissingBean 👉 Result: Beans get configured automatically 🌐 Simple Example Add: spring-boot-starter-web Spring Boot assumes: You need a web app So it adds an embedded server (Tomcat) automatically 🛠️ Can You Override It? YES You can: Define your own beans Override defaults Disable auto-config if needed Auto-configuration isn’t magic. It’s just smart defaults + conditional logic working for you #Java #SpringBoot #SoftwareDevelopment #100DaysOfCode #Backend
To view or add a comment, sign in
-
-
🔍 Post 1/3 — How to Actually Explore Spring Boot Dependencies (Beyond Ctrl+Click) Most developers stop at: 👉 Ctrl + Click on a dependency That’s useful… but shallow. If you want to understand what’s REALLY inside your Spring Boot app, go deeper 👇 🧠 What’s happening behind the scenes? When you add: spring-boot-starter-web You’re not just adding a library. You’re pulling in: Embedded server Servlet container Dozens of transitive dependencies Example: spring-boot-starter-web └── spring-boot-starter-tomcat └── tomcat-embed-core 👉 That’s how Apache Tomcat gets into your app. 🔧 Tools you should actually use ✔️ IDE shortcuts Ctrl + Click → Source Ctrl + Alt + B → Implementation Dependency diagram → Full view ✔️ Maven (MUST KNOW) mvn dependency:tree ✔️ Maven Central Search artifacts and inspect full dependency chains 💡 Why this matters If you don’t understand dependencies: You can’t debug conflicts You can’t optimize startup/performance You don’t know what’s running in production 👉 Backend engineering is NOT just writing APIs It’s understanding the runtime stack. Next post: What exactly is a “Servlet Request” and who creates it? #SpringBoot #Java #BackendDevelopment #SoftwareEngineering #Maven #Developers #Programming #TechDeepDive #JavaDevelopers
To view or add a comment, sign in
-
Your API crashed in production. User sees a 500 error with a scary stack trace. 😬 Unhandled exceptions don't just break apps — they break trust. That's where Spring Boot Exception Handling saves you. ✨ What it does: Using @ControllerAdvice and @ExceptionHandler, you catch errors globally instead of writing try-catch everywhere. One place. Clean responses. Happy users. 💡 Real-world example: A banking app user tries to withdraw ₹10,000 with only ₹500 in balance. Instead of a messy stack trace, your handler returns: { "status": 400, "message": "Insufficient balance" } Clean. Professional. Production-ready. ✅ 🔑 Key takeaways: → Use @ControllerAdvice for global handling → Create custom exceptions (ResourceNotFoundException) → Return proper HTTP status codes (400, 404, 500) → Build a consistent error response DTO → Never expose stack traces to end users Good devs write code that works. Great devs write code that fails gracefully. 🚀 What's your go-to exception handling pattern? 👇 #Java #SpringBoot #BackendDeveloper #JavaDeveloper #SoftwareEngineering #Microservices #RESTAPI #Coding #Programming #Tech #100DaysOfCode #WebDevelopment #SoftwareDevelopment #DeveloperCommunity #TechCommunity
To view or add a comment, sign in
-
-
Working with APIs in Spring Boot but not using Swagger yet? You’re missing out on something really powerful 👇 Swagger (OpenAPI) makes your APIs easy to understand, test, and document — all in one place. 👉 It automatically generates API documentation 👉 You can test APIs directly from the browser (no Postman needed) 👉 Clean UI to explore endpoints, request/response 👉 Helps in designing APIs better 💡 How to enable it in Spring Boot? Just add this dependency: springdoc-openapi-starter-webmvc-ui Run your app… and that’s it 😄 👉 Open this URL in your browser: http://localhost:8080/swagger-ui.html (or in newer versions 👉 /swagger-ui/index.html) And boom 💥 your API documentation + testing UI is ready! If you're building REST APIs and not using Swagger… you're making things harder than they need to be. #SpringBoot #Swagger #OpenAPI #BackendDevelopment #APIDevelopment #Java
To view or add a comment, sign in
-
-
Understanding HTTP Status Codes Today I focused on an important concept in backend development — HTTP Status Codes While building REST APIs, it’s not just about sending data, but also about sending the right response to the client. 🔹 Learned about different categories of status codes: • 2xx (Success) – 200 OK, 201 Created • 4xx (Client Errors) – 400 Bad Request, 404 Not Found • 5xx (Server Errors) – 500 Internal Server Error 🔹 Understood when to use each status code in real APIs 🔹 Implemented status handling using "ResponseEntity" in Spring Boot This helped me realize how APIs communicate clearly with frontend applications and handle errors properly. Small concept, but very powerful in building real-world applications. Next step: Improving API structure and adding more real-world logic. #Java #SpringBoot #BackendDevelopment #RESTAPI #CodingJourney
To view or add a comment, sign in
-
𝗪𝗵𝘆 𝗦𝗽𝗿𝗶𝗻𝗴 𝗕𝗼𝗼𝘁 𝗔𝗽𝗽𝘀 𝗦𝗹𝗼𝘄 𝗗𝗼𝘄𝗻 𝗶𝗻 𝗣𝗿𝗼𝗱𝘂𝗰𝘁𝗶𝗼𝗻 A Spring Boot app can feel fast in local testing. Small dataset, low traffic, almost no latency. Then production traffic hits… and response times suddenly increase. In most cases, Spring Boot itself is not the problem. 𝗧𝗵𝗲 𝗿𝗲𝗮𝗹 𝗯𝗼𝘁𝘁𝗹𝗲𝗻𝗲𝗰𝗸𝘀 𝗮𝗿𝗲 𝘂𝘀𝘂𝗮𝗹𝗹𝘆: 🔹 𝘋𝘢𝘵𝘢𝘣𝘢𝘴𝘦 𝘘𝘶𝘦𝘳𝘪𝘦𝘴 Missing indexes, N+1 queries, unnecessary joins, or fetching more data than needed can make APIs slow very quickly. 🔹 𝘛𝘩𝘳𝘦𝘢𝘥 𝘗𝘰𝘰𝘭 𝘔𝘪𝘴𝘤𝘰𝘯𝘧𝘪𝘨𝘶𝘳𝘢𝘵𝘪𝘰𝘯 Async tasks, request handling, and DB connection pools need proper tuning. Too small creates waiting, too large creates overhead. 🔹 𝘓𝘰𝘨𝘨𝘪𝘯𝘨 & 𝘚𝘦𝘳𝘪𝘢𝘭𝘪𝘻𝘢𝘵𝘪𝘰𝘯 Debug logs, full request/response logging, and huge JSON payloads add hidden latency under load. 🔹 𝘗𝘳𝘰𝘥𝘶𝘤𝘵𝘪𝘰𝘯 𝘈𝘴𝘴𝘶𝘮𝘱𝘵𝘪𝘰𝘯𝘴 What works for 100 requests may fail at 10,000. Real data and real concurrency expose design decisions. The important lesson 👇 Production rarely creates slowness. It usually reveals the hidden cost of earlier decisions. Fast systems are not built by chance. They are built by measuring the real bottleneck. What slowed down your Spring Boot app the most in production? #SpringBoot #Java #BackendDevelopment #Performance #SoftwareEngineering #JavaDeveloper
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