🚀 Ever wondered how Spring Boot knows which class to run when you execute a JAR? When you run: 👉 java -jar your-app.jar The JVM doesn’t magically detect your main class. It simply follows instructions from a file inside the JAR 👇 📦 META-INF/MANIFEST.MF Spring Boot (via spring-boot-maven-plugin) automatically generates this with: Main-Class → JarLauncher Start-Class → Your actual application class 💡 Execution Flow: JVM → reads MANIFEST.MF → starts JarLauncher → loads your main class → runs main() ⚙️ How do you create this JAR? In IntelliJ (Maven project): Go to Maven → Lifecycle → package This runs mvn clean package Your executable JAR is created in target/ ⚠️ Important: Without spring-boot-maven-plugin, your JAR won’t be executable (java -jar will fail). 💡 Simple way to remember: 👉 JVM doesn’t guess the main class — it reads it from MANIFEST.MF. Have you ever faced the “no main manifest attribute” error? 😅 #SpringBoot #Java #Backend #SoftwareEngineering #DeveloperTips #JavaDeveloper
Spring Boot JAR Execution Flow: Main-Class in MANIFEST.MF
More Relevant Posts
-
Master Spring Boot Setup in Minutes! Are you looking to dive into Java Backend development but don't know where to start? I’ve just dropped a complete guide on setting up a Spring Boot project from scratch! In this tutorial, I break down: Using Spring Initializr like a pro Choosing the right Java versions (why Java 17 is key!) Adding essential dependencies (Web, JPA, Lombok) Running your first build with Maven Whether you are a student or an intermediate dev looking to refresh your workflow, this video has you covered. Watch the full tutorial here: https://lnkd.in/dhdx7wy3 Useful Resources from the video: Spring Initializr: https://start.spring.io Maven Installation Guide: https://lnkd.in/d3jKsdwn Spring Boot Docs: https://lnkd.in/dKeecXTF Don't forget to Like, Share, and Subscribe to the channel for more "Unshakable" dev content! #SpringBoot #JavaDevelopment #BackendDev #CodingTutorial #SpringFramework #Java17 #Maven #UnshakableDev
To view or add a comment, sign in
-
Your Docker image is 1GB. Your actual Java application JAR is 200MB. Where is the other 800MB coming from? JDK. Maven. Source code. Build cache. Tools you needed to BUILD the app — but have absolutely no reason to be in your PRODUCTION image. This is the problem Docker Multi Stage Builds solve. Here is how it works 👇 Stage 1 — Builder → Use a full JDK image to compile your code → Run Maven to build and package the JAR → This stage is heavy — and that is fine Stage 2 — Runtime → Start fresh with a minimal JRE image → Copy only the JAR from Stage 1 using COPY --from → Nothing else — no JDK, no Maven, no source code Result? → Final image goes from 1GB to 200MB → Zero build tools in production → Dramatically smaller attack surface → Faster image pulls across all environments Docker builds all stages but only the final stage becomes the image that gets pushed and deployed. All the heavy build stuff is discarded automatically. In my latest video I showed this live with a Java Spring Boot Application — built the same app with single stage and multi stage Dockerfile and showed the image size difference side by side. The numbers speak for themselves. 🔗 Link in comments 👇 Found this useful? Repost ♻️ #Docker #DevOps #DevOpsInterview #DockerInterview #Dockerfile #Containerization #DevOpsCommunity #ayushbuildstech
To view or add a comment, sign in
-
-
Excited to share my first ever Medium article! 🎉 I wrote a deep dive on Build Tools & Maven for Spring Boot developers. Here's what's covered: → What build tools actually are & why every Java dev needs to understand them → How Maven fetches dependencies from Maven Central Repository → Maven's full build lifecycle — phase by phase → How the Spring Boot executable JAR is created If you've ever copy-pasted a pom.xml without fully understanding it — this one's for you. Link: https://lnkd.in/ghuv7wKp #Java #SpringBoot #Maven #BuildTools #SpringFramework #JavaDeveloper #BackendDeveloper #SoftwareEngineer #SoftwareDevelopment #100DaysOfCode #LearningInPublic #OpenToWork #TechCommunity #Programming #Coding #Developer #Tech
To view or add a comment, sign in
-
🚀From Chaos to Clarity: My Journey from Core Java to Spring Boot Ever felt like you're spending more time managing configurations than actually building something meaningful? 😅 👉 BEFORE (Core Java) Endless XML configs, manual setup, dependency headaches… “Main developer hoon ya configuration manager 😂” 👉 AFTER (Spring Boot) Auto-configuration, embedded servers, faster development… “Life sorted 😄” 💡 What changed? Spring Boot didn’t just simplify development—it changed the way I think about building applications. Instead of focusing on setup, I now focus on logic, features, and user experience. 🔥 Bonus Insight (Important for Beginners): Spring Boot is powerful, but don’t skip Core Java fundamentals. Understanding concepts like OOP, collections, multithreading, and JVM helps you truly master Spring Boot instead of just using it. 📌 Key Takeaway: Tools like Spring Boot don’t replace fundamentals—they amplify them. If you're starting your backend journey, trust the process: 👉 Core Java → JDBC → Servlets → Spring Core → Spring MVC → Hibernate → JPA → Spring Boot → Projects → Advanced (Security + Microservices) #Java #SpringBoot #BackendDevelopment #CodingLife #Developers #Programming #SoftwareDevelopment #LearningJourney
To view or add a comment, sign in
-
-
🚀 Exploring VS Code Extensions – Built a Practical Java Utility While working on improving my development workflow, I created a custom VS Code extension that reduces repetitive coding in Java. 👉 Instead of manually writing classes, you can simply write: abc.print("Hello"); And the extension automatically generates the required Java class in real-time. 💡 Key Capabilities: Detects any .print() usage Dynamically creates the corresponding class Works instantly while editing Java files Helps reduce boilerplate code ⚙️ Tech Stack: TypeScript • VS Code Extension API • Java 📦 How to Use (Important): Since this is not published on the VS Code Marketplace, you can use it locally: Download the .vsix file from GitHub Open VS Code Press Ctrl + Shift + P Select Install from VSIX Choose the downloaded file Start using it in any .java file 🔗 GitHub Repository: (https://lnkd.in/dnj575B3) I’m continuously working on improving this and adding more features. Feedback and suggestions are always welcome! #Java #VSCode #DeveloperTools #TypeScript #Coding #SoftwareDevelopment #BuildInPublic
To view or add a comment, sign in
-
Still writing getters, setters, constructors manually in Spring Boot? 😅 You might be missing out on something really powerful… Lombok 👇 Lombok is a Java library that helps you reduce boilerplate code using simple annotations. 👉 No more writing getters/setters 👉 No more constructors manually 👉 Cleaner and more readable code Just add the dependency and use annotations like: @Getter @Setter @AllArgsConstructor @NoArgsConstructor And boom 💥 your code becomes short and clean. 💡 How to use it? Add Lombok dependency Enable annotation processing (important ⚠️) Use annotations in your class That’s it… Lombok handles the rest 🚀 If you're a Spring Boot developer and not using Lombok yet, you're writing more code than you need to. #SpringBoot #Java #Lombok #CleanCode #BackendDevelopment
To view or add a comment, sign in
-
-
🚀 Understanding Dependency Injection in Spring Boot As a Java Backend Developer, one concept that truly changed how I design applications is Dependency Injection (DI). 👉 What is Dependency Injection? Dependency Injection is a design pattern in which an object receives its dependencies from an external source rather than creating them itself. This helps in building loosely coupled, testable, and maintainable applications. Instead of: ❌ Creating objects manually inside a class We do: ✅ Let the framework (like Spring Boot) inject required dependencies automatically 💡 Types of Dependency Injection in Spring Boot 1️⃣ Constructor Injection (Recommended) Dependencies are provided through the class constructor. ✔ Promotes immutability ✔ Easier to test ✔ Ensures required dependencies are not null 2️⃣ Setter Injection Dependencies are set using setter methods. ✔ Useful for optional dependencies ✔ Provides flexibility 3️⃣ Field Injection Dependencies are injected directly into fields using annotations like @Autowired. ✔ Less boilerplate ❌ Not recommended for production (harder to test & maintain) 🔥 Why use Dependency Injection? ✔ Loose coupling ✔ Better unit testing ✔ Cleaner code architecture ✔ Easy to manage and scale applications 📌 In modern Spring Boot applications, Constructor Injection is considered the best practice. 💬 What type of Dependency Injection do you prefer and why? #Java #SpringBoot #BackendDevelopment #SoftwareEngineering #CleanCode #DependencyInjection
To view or add a comment, sign in
-
🚀 Recently, I revisited a Java & Spring Boot course I had started earlier — this time with a focus on going beyond day-to-day development. 💡 While working on projects, we often use frameworks efficiently, but this helped me explore what happens under the hood. 📌 Some key concepts I deep-dived into: • ⚙️ How Spring Boot auto-configuration actually works • 🔄 Bean lifecycle & dependency injection at a deeper level • 🔁 Writing idempotent APIs and handling retries • 🧩 Understanding transaction propagation in real scenarios • 🏗️ Basics of system design for scalable backend services • 🧵 Thread safety and concurrency basics in Java 🔍 What made this valuable is connecting these concepts with real production scenarios and improving how I think about backend systems. 📈 Continuous improvement > Comfort zone. #Java #SpringBoot #BackendDevelopment #Microservices #SystemDesign #Learning
To view or add a comment, sign in
-
-
📂 Understanding #Spring_Boot_ProjectStructure Today I explored the basic project structure of a Spring Boot application, and it made backend development feel much more organized 🚀 Here’s the simple breakdown 👇 📁 src/main/java This is where we write the main Java code: ✔ Controllers ✔ Services ✔ Models ✔ Repositories 📁 src/main/resources This folder contains important resources like: ✔ application.properties → configuration settings ✔ static → HTML, CSS, JS files ✔ templates → Thymeleaf templates 📄 pom.xml This file contains all the project dependencies and Maven build configuration. 💡 What I learned: A clean project structure makes development easier, scalable, and beginner-friendly. Understanding folders is the first step to building real Spring Boot applications 💻✨ Excited to dive deeper into controllers and REST APIs next 🚀 #SpringBoot #Java #BackendDevelopment #LearningJourney #ProjectStructure #DeveloperLife 10000 Coders
To view or add a comment, sign in
-
-
Spring vs Spring Boot — not the same thing 👇 When I started backend development, I used to think Spring and Spring Boot were basically identical. They’re not. Here’s the simple breakdown: 🔹 Spring = the core framework Gives you powerful tools, flexibility, and full control over configuration. 🔹 Spring Boot = built on top of Spring Adds auto-configuration, sensible defaults, and helps you build production-ready apps faster. 👉 With Spring, you configure more things manually. 👉 With Spring Boot, most of that setup is handled for you. That’s why today, most modern Java projects start with Spring Boot. But here’s what really matters: Using Spring Boot is great. Understanding the Spring foundation underneath it is what makes you a strong developer. 💡 Takeaway: Don’t just use the tools — understand how they work. #Java #Spring #SpringBoot #BackendDevelopment #SoftwareEngineering #Programming #Developers #TechLearning #Microservices #CodingJourney
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