Preparing for Java and Spring Boot Interview?

Join my Newsletter, its FREE

Tuesday, April 23, 2024

4 Ways to take Heap dump in Tomcat and Java and 3 Tools to Analyse .hprof files

The heap dump is a great source of information on identifying memory related issues on Java application e.g. web and application servers like Tomcat, WebLogic, JBoss, WebSphere and IDEs like IntelliJIDEA and Eclipse. When you take heap dump all live objects of heap with their count and other details are written into a huge file (the .hprof file) for analysis. The name and location of heap dump file is provided by command you use to take the heap dump. There are many command line tools in JDK e.g. jmap and jcmd which can be used to take the heap dump in Java. 

Monday, April 22, 2024

Top 50 Java 8 Stream, Lambda, and Functional Programming Interview Questions

Hello guys, if you are preparing for Java interviews and looking for some Java 8 Stream, Lambda Expression, and other Java 8 features then you have come to the right place. Earlier, I have shared 140+ Core Java interview questions, 50 Java Programs from Interviews and 20+ Spring Boot questions and in this article, I am going to share Stream, Lambda expression, and other Java 8 feature-based questions.  Java 8 features are now not remained as good to know features. They have been increasingly adopted by many organizations and most of the new development encourage developers to write code in Java 8 style to take full advantage of massive CPU power available in modern servers like HP 380 Gen 8 servers, also known as G8. 

Sunday, April 21, 2024

Top 3 Design Patterns and Best Practices Java Developers Can Learn From Spring Framework

There is no doubt that the Spring Framework is one of the most popular Java frameworks and makes it really easy to create real-world, enterprise-grade Java applications easy by providing features like dependency injection and inversion of control. But, to be honest, Spring is much more than just another DI and IOC framework. It goes one more level to simplify many Java APIs like JDBC, JMS, Java Mail, etc by providing a useful layer of abstraction. It's much more comfortable to work with JDBC with Spring's JdbcTempalte and other utility classes. They remove most of the friction Java developer faces with respect to executing SQL statements and processing ResultSet to get the Java object they want.

2 Reasons of org.springframework.beans.factory.BeanCreationException: Error creating bean with name [Solution]

The Spring framework is one of the most popular frameworks for developing Java applications. Apart from many goodies, it also provides a DI and IOC container that initializes objects and their dependencies and assembles them together. The Java classes created and maintained by Spring are called Spring bean. At the startup, when the Spring framework initializes the system by creating objects and their dependencies depending upon @Autowired annotation or spring configuration XML file, it throws "org.springframework.beans.factory.BeanCreationException: Error creating a bean with name X" error if it is not able to instantiate a particular Spring bean.

Top 21 Spring Framework and Spring Boot Testing Interview Questions Answers for 2 to 5 Years Experienced

Testing is an important part of Software development but many people don't pay attention to it only to find bugs in the later stages of development that can be easily avoided by unit testing. When it comes to Java and Spring Boot development, we are lucky to have JUnit, Mockito, JsonPath, AssertJ, and some in-built testing facilities on Spring Framework and Spring Boot for our testing needs. Since the advent of DevOps, there is an increased focus on automation testing and that's why unit testing and integration testing has become important topics on Java Interviews and it's essential for Java developers to have in-depth knowledge about how to test a Spring framework and Spring Boot based Java application.

Saturday, April 20, 2024

10 Example of find command in UNIX and Linux

The find command is one of the most versatile commands in UNIX and Linux, and I used it a lot in my day-to-day work. I believe having a good knowledge of find command in UNIX and understanding of its different options and usage will increase your productivity a lot in UNIX based operating systems, e.g. Redhat Linux or Solaris. If you are a QA, support personnel, and your works involve lots of searching text on Linux machine or if you are a Java or C++ programmer and your code resides in UNIX, find command can significantly help you to look for any word inside your source file in the absence of an IDE.

Friday, April 19, 2024

Differences between @RequestParam and @PathVariable annotations in Spring MVC?

The Spring MVC framework, one of the most popular frameworks for developing a web application in Java world also provides several useful annotations to extract data from the incoming request and mapping the request to the controller, like @RequestMapping, @GetMapping, @RestController, @RequestParam, and @PathVariable. Even though both @RequestParam and @PathVariable are used to extract values from the HTTP request, there is a subtle difference between them, which makes them a useful question from a Spring Framework interview and spring certification point of view. We'll examine the subtle difference between @RequestParam and @PathVaraible in this article.

Top 25 Spring Security Interview Questions Answers for Java Developers

Hello guys, Spring Security is one of the most popular security frameworks in the Java world and I strongly believe that every experienced Java developer should learn it. Because of its popularity, there is always some question on Spring Security on Java interviews but there are not enough resources to prepare for that. That's why when  I shared the Spring MVC questions and spring boot interview question last year, a lot of you asked me to share similar interview questions on Spring Security, Spring Cloud, and Microservices. I listen to those requests and have been doing some research since then to write those articles. 

Thursday, April 18, 2024

How Spring MVC Framework works? How HTTP Request is processed?

Hello guys, one of the frequently asked Spring MVC Interview questions is about explaining the flow of web requests i.e. how an HTTP request is processed from start to end. In other words, explaining the flow of requests in Spring MVC. Since many of my readers ask this question time and again, I thought to summarize the flow of request processing in a short article. It all starts with the client, which sends a request to a specific URL. When that request hits the web container like Tomcat it looks into web.xml and finds the Servlet or Filter which is mapped to that particular URL. It the delegate that Servlet or Filter to process the request. Since Spring MVC is built on top of Servlet, this is also the initial flow of requests in any Spring MVC based Java web application.

Friday, April 12, 2024

Top 7 Spring and Hibernate Training Courses for Java JEE Programmers in 2024 - Best of Lot

Spring and Hibernate are two of the hottest and most in-demand web frameworks in the Java world and also two of the most essential skill for any Java programmer to get a job in the web development space. The Spring framework is in around 2004 and established itself as the leading framework to develop Java applications both in core Java and web development areas. The Spring framework comes with a lot of modules to support different kinds of developments like Spring Security to address the security requirements of most web and enterprise Java applications. It supports single sign-on, LDAP authentication, Role-based access control, and much more such essential features. Spring also supports the development of REST services which is now become a standard way to provide web services.

Thursday, April 11, 2024

10 Examples of @RequestMapping Annotation in Spring MVC and REST

The @RequestMapping annotation is one of the most important annotation of Spring MVC which provides mapping of HTTP requests to controller methods, I mean Java methods on Controller class for processing. If you wonder, how Spring handles a particular request and which method from controller class is called for a particular request, answer lies on @RequestMapping annotation. This annotation maps web request to methods on controller class. You can apply @RequestMapping on class or method level of your controller. This is a powerful annotation and give you a lot of option to sophistically map a web request e.g. you can narrow down mapping by using HTTP headers, HTTP methods e.g. PUT or POST, and by using Query parameters.

Top 10 Java Programming Courses for Beginners to Learn Online in 2024 - Best of Lot

If you are a computer science graduate or someone who wants to learn Java and looking for some awesome resources like books, tutorials, and online courses then you have come to the right place. In the past, I have shared some great books, websites, and tutorials to learn Java and in this article, I am going to share some of the best Java courses beginners can join to learn Java in 2024. One of the main problems with learning Java is keeping pace with the increasing number of releases. For example, Java 8 release completely changed how Java is written and after that, we have many Java releases in the form of Java 9Java 10, Java 11, 12, 13, 14, 15, 16, and now Java 17. But the good thing is that the core of Java is still the same and all its releases are backward compatible.

Top 5 Courses to learn Microsoft Azure Cloud in 2024 - Best of Lot

Hello guys, if you want to learn about the Microsoft Azure Cloud Platform, you have come to the right place. In the past, I have shared the best courses to pass Azure FundamentalsAzure Administrator, and Azure Architect certifications. Today, I will share the best online course to learn the Azure platform for Beginners. These are top-quality courses from expert trainers and instructors and are picked from Udemy, Coursera, and edX. You can use these courses to learn Microsoft Azure core services and prepare for different Microsoft Azure certifications like AZ-900, AZ-303, and AZ-20 Azure developer associate certification.

Top 3 Books to Learn Java for C and C++ Programmer?

In the last 2 decades, many Java programmers started programming with C and C++, but the situation is changed now, you have more choices like you can choose Python, or you can even start with Java. It seems Academia prefers Python in the USA and Java in India, but there are still many programmers who know C and C++ and want to learn Java for one or other reasons. I often receive emails from my readers about book recommendation, and recently, a couple of them asked me to suggest the best Java books for C and C++ programmers. I can relate those beginners to myself because I have also gone through the same phase, but those days, the university textbooks are our only source to learn new things. We didn't have broadband, and unlimited access to the Internet and eBooks was not popular at that time, but things have changed.

Wednesday, April 10, 2024

How to limit Concurrent Login Sessions in a Java web application using Spring Security? Example

If you don't know, Spring security can limit the number of sessions a user can have in a Java web application. If you are developing a web application especially a secure web application in Java JEE then you must have come up with the requirement similar to many online banking portals have like only one session per user at a time or no concurrent session per user. If the user tries to open a new session then either an alert is shown or his previous session is closed. Even though you can also implement this functionality without using spring security but with Spring security, it's just a piece of cake with coffee :).