💡 𝐃𝐨 𝐮𝐧𝐮𝐬𝐞𝐝 𝐢𝐦𝐩𝐨𝐫𝐭𝐬 𝐚𝐟𝐟𝐞𝐜𝐭 𝐚 𝐒𝐩𝐫𝐢𝐧𝐠 𝐁𝐨𝐨𝐭 𝐚𝐩𝐩𝐥𝐢𝐜𝐚𝐭𝐢𝐨𝐧'𝐬 𝐩𝐞𝐫𝐟𝐨𝐫𝐦𝐚𝐧𝐜𝐞? 𝐍𝐨. 𝐁𝐮𝐭 𝐰𝐡𝐲? In 𝐉𝐚𝐯𝐚, import statements are only used by the compiler to resolve class names during 𝐜𝐨𝐦𝐩𝐢𝐥𝐚𝐭𝐢𝐨𝐧. If an 𝐢𝐦𝐩𝐨𝐫𝐭 is not used, the compiler simply ignores it, and it does not appear in the compiled .𝐜𝐥𝐚𝐬𝐬 file. That means unused imports have zero impact on: - Application performance - Memory usage - Spring Boot startup time - Runtime behavior However, they can still affect code readability and cleanliness, so it's a good practice to remove them regularly. 💻 𝐓𝐢𝐩: In 𝐈𝐧𝐭𝐞𝐥𝐥𝐢𝐉 𝐈𝐃𝐄𝐀, you can instantly remove all unused imports in a class using 𝐎𝐩𝐭𝐢𝐦𝐢𝐳𝐞 𝐈𝐦𝐩𝐨𝐫𝐭𝐬. Clean code isn't just about functionality; it's about clarity and maintainability too. #CodingTips #SoftwareEngineering #Java #SpringBoot
Unused imports affect Spring Boot performance
More Relevant Posts
-
Why Spring Is Moving Back Toward Simplicity Reactive programming became popular because: - Threads were expensive - Blocking didn’t scale That led to code like this: Mono<User> user = service.getUser() .flatMap(this::validate) .flatMap(this::enrich); Powerful — but hard to: - Read - Debug - Maintain Virtual threads allow this again: User user = service.getUser(); validate(user); enrich(user); Same scalability. Much clearer flow. 💡 Takeaway: Spring and Java are converging toward readability. #Java #SpringBoot #BackendEngineering #Java25
To view or add a comment, sign in
-
Day 37 - Implement Queue using Stacks Implemented a FIFO queue using two stacks while supporting operations like push, pop, peek, and empty. Used one stack for input and another for output. Elements are transferred only when needed to maintain the correct order. Time Complexity: Amortized O(1) #Day37 #LeetCode #Java #Stack #Queue #DSA #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
Day 35 - Min Stack Designed a stack that supports push, pop, top, and retrieving the minimum element in constant time. Used an auxiliary stack to track the minimum value at each stage, ensuring efficient updates during push and pop operations. Time Complexity: O(1) for all operations #Day35 #LeetCode #Java #Stack #DSA #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
Day 38 Explored some core concepts of the Spring Framework through hands-on practice. 🔹 Bean Configuration – Understanding how Spring manages and creates objects using the IoC container. 🔹 @Component – Learned how Spring automatically detects and registers classes as beans. 🔹 @Autowired – Explored dependency injection and how Spring automatically injects required dependencies. It was interesting to see how these concepts reduce manual object creation and make applications more loosely coupled. Step by step diving deeper into the Spring ecosystem. 🚀 #SpringFramework #Java #BackendDevelopment #DependencyInjection #LearningInPublic
To view or add a comment, sign in
-
Day 64 — LeetCode Progress (Java) Problem: Remove Element Required: Given an array nums and a value val, remove all occurrences of val in-place and return the new length of the array. Idea: Use a two-pointer approach to overwrite unwanted elements while maintaining the order of remaining elements. Approach: Maintain a pointer k to track the position of valid elements. Traverse the array: If the current element is not equal to val, place it at index k Increment k All valid elements are moved to the front of the array. Return k as the new length. Time Complexity: O(n) Space Complexity: O(1) #LeetCode #DSA #Java #TwoPointers #Arrays #Algorithms #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
The code you write is not necessarily the code that runs You can write code that never runs. Not because of a bug. Not because of a condition. But because the JVM decided it was useless. Once the JIT compiler kicks in, your source code stops being a reliable map of what actually executes ⚙️ The JIT doesn’t just translate your code. It decides what is worth executing. Its core rule is simple: observable effects. If a piece of code produces no effect that survives execution — no state change, no escaped value, no externally visible behavior — then it becomes a candidate for elimination. This is not theoretical. - a “warm-up” loop warms up absolutely nothing - a micro-benchmark measures empty space 🔍 - an initialization block quietly disappears - performance improves without any visible code change From the IDE, everything looks fine. From the JVM’s perspective, the work was pointless. And the JVM always wins. That’s why diagnosing JVM performance issues is not just about reading code carefully. It’s about understanding what survives execution 🧠 Sometimes, the bug is not in the code. Sometimes, the problem is the assumption that the code exists at all. #Java #JVM #Performance #Backend #SoftwareEngineering
To view or add a comment, sign in
-
Day 15/100 – LeetCode Challenge Problem: Reverse Linked List Today’s problem focused on reversing a singly linked list using an iterative approach. Approach: Used three pointers to reverse the links: prev → keeps track of the previous node curr → current node being processed next → stores the next node before changing the link Steps: Store curr.next in next Reverse the link → curr.next = prev Move prev and curr one step forward Continue until the list ends. Finally, prev becomes the new head of the reversed list. Complexity: Time: O(n) Space: O(1) Concepts Practiced: Linked List pointer manipulation Iterative reversal technique In-place algorithm #100DaysOfCode #LeetCode #DSA #Java #LinkedList #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
🚀 Day 38 of #100DaysOfCode 🌱 Topic: Linked List / Recursion ✅ Problem Solved: LeetCode 24 – Swap Nodes in Pairs 🛠 Approach: Used a recursive approach to swap every two adjacent nodes in the linked list. If the list has 0 or 1 node, return it directly (base case). Store the second node (head.next) as a temporary node. Recursively swap the remaining list starting from temp.next. Adjust pointers so the second node becomes the new head of the pair. Connect the swapped pair with the recursively processed list. This swaps nodes without modifying their values, only changing pointers. #100DaysOfCode #Day38 #DSA #LinkedList #Recursion #LeetCode #Java #ProblemSolving #CodingJourney #Consistency
To view or add a comment, sign in
-
-
5 Spring Boot mistakes I see (and have made) 😅 1️⃣ Using @Autowired on fields Everyone starts here. But field injection hides dependencies and makes testing painful. Switch to constructor injection — your future self will thank you. 2️⃣ Ignoring N+1 queries in JPA You write a simple findAll() and suddenly 200 queries hit your DB. Always check your query count. @EntityGraph or JOIN FETCH saves the day. 3️⃣ Returning entities directly from controllers Exposing your DB model directly to the API is a security and maintenance nightmare. Use DTOs. Always. 4️⃣ Not using @Transactional properly Calling a @Transactional method from within the same class? Spring AOP proxy won't intercept it. Transaction silently doesn't work. Took me a while to figure this one out 😅 5️⃣ Hardcoding configs instead of using application.properties DB URLs, secret keys, timeouts hardcoded in the class. Move everything to application.properties or environment variables. Especially anything security related. ───────────────────────── Which one have you been guilty of? 👇 #Java #SpringBoot #BackendDevelopment #JavaDeveloper #Programming #SoftwareEngineering
To view or add a comment, sign in
-
The @Component annotation is Spring’s primary stereotype for marking a Java class as a managed bean. During classpath scanning, Spring automatically detects these annotated classes and registers them in the ApplicationContext to enable Dependency Injection. This allows the framework to handle the entire object lifecycle and fulfill dependencies through Inversion of Control. It also serves as the foundation for specialized annotations like @Service and @Repository, which provide additional architectural context and layer-specific behavior. Session is live on my YT channel. Please attend the complete session and share with fellow developers. Here is the session link - https://lnkd.in/gNKzts3k #SpringBoot #Java #SpringFramework #BackendDevelopment #thinkconstructive #TechLearning #JavaDeveloper #SoftwareEngineering #SoftwareDeveloper
Spring Component Annotation Tutorial : Spring Framework & Spring Boot Annotation
https://www.youtube.com/
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