Blog Archives
1 2 3

01: Q01 – Q07 Spring core interview Q&As

Spring interview questions are very common for the Java programmer jobs.

Q1. What do you understand by the terms Dependency Inversion Principle (DIP), Dependency Injection (DI) and Inversion of Control (IoC) container?

Read more ›



01: Spring DI & IoC interview Q&As

Video: Spring DIP, DI, and IoC. This extends 13 Spring interview questions & answers.

Q1. What do you understand by the terms Dependency Inversion Principle (DIP), Dependency Injection (DI) and Inversion of Control (IoC) container?

Read more ›



01: Spring MVC beginner tutorial step by step

This tutorial extends Getting started with Apache Tomcat application server by deploying a simple JEE Application to introduce Spring MVC.

Spring dependencies via Maven

Step 1: Modify the pom.xml file in the simpleWeb project to bring in the Spring web dependency jars.

Read more ›



01b: Q08 – Q13 Spring interview Q&As

This extends 13 Spring basics Q1 – Q7 interview questions & answers. Q8. Can you describe the high level Spring architecture? A8. A Spring Bean represents a POJO (Plain Old Java Object) performing useful operation(s). All Spring Beans reside within a Spring IoC Container. … Read more ›...



02: Spring MVC form submission tutorial step by step

This tutorial extends Spring MVC beginner tutorial step by step.

Maven project structure
Model class to capture login form details

Step 1: Create a POJO “Login.java” in the package “com.mytutorial.model” under “src/main/java”

Read more ›



02: Understanding Hibernate proxy objects and avoiding potential pitfalls

Q. How does hibernate support lazy loading? A. Hibernate uses a proxy object to support lazy loading. Basically as soon as you reference a child or lookup object via the accessor/getter methods, if the linked entity is not in the session cache (i.e. the first-level cache), … Read more ›...



03: Identifying and fixing NonUniqueObjectException in Hibernate

NonUniqueObjectException is thrown when there is an object already associated with the session with the same id (primary key) (i.e. a duplicate). It is important to understand the concept of a “detached” object in Hibernate. This is one of the most common errors, understanding why and when this error is thrown will save you time in identifying and fixing this issue.

Read more ›



03: Spring MVC with Java Configs instead of XML configs step by step

This tutorial extends Spring MVC form submission tutorial step by step. This tutorial gets rid of web.xml and applicationContext.xml files.

pom.xml changes

Step 1: Add “JSTL” (i.e. JSP Standard Tag Library ) jar dependency,

Read more ›



04 17 Spring bean life cycles & scopes FAQs

Q1. Does Spring dependency injection happen during compile time or runtime? A1. Runtime during creating an object. Q2. What is the difference between prototype scope and singleton scope? Which one is the default? A2.Singleton means single bean instance per IoC container, … Read more ›...



04: Identifying and fixing LazyInitializationException in Hibernate

LazyInitializationException is thrown when an object becomes detached, and if you try to access associated (i.e. proxied) object(s) of a detached object.

Q. What is a detached object in Hibernate?

When you close an individual Hibernate Session, the persistent objects you are working with are detached.

Read more ›



04: Spring MVC with Thymeleaf and JavaConfigs

Project structure

pom.xml to bring-in Thymeleaf & Spring jars

Step 1: Add “Thymeleaf“jar dependency, and also override default “maven-war-plugin” by explicitly adding the”failOnMissingWebXml” to false to not have web.xml as we will be using JavaConfigs and AbstractAnnotationConfigDispatcherServletInitializer.

Read more ›



05: 9 Spring Bean scopes interview Q&A

Q1. Does Spring dependency injection happen during compile time or runtime? A1. Runtime during creating an object. Q2. What is the difference between prototype scope and singleton scope? Which one is the default? A2. Singleton means single bean instance per IoC container, … Read more ›...



05: Debugging Hibernate & handling 4 common issues

#1. Enable Logging in your log4j.xml, log4j.properties, or myapp-logback.xml

In the log4j.properties file, you can enable Hibernate SQL logging as shown below

or in your log4j.xml or myapp-logback.xml as

You can then check your logs for the SQLs executed and the parameters passed. The example below shows 3 parameters passed to an update query

#2.

Read more ›



1 2 3

800+ Java Q&As & tutorials

Top