What is wrapper class and why we need them?

A wrapper class in Java is an object representation of primitive data types. Wrapper classes allow primitive types (e.g., int, double) to be treated as objects. Examples of Wrapper Classes: Primitive Type Wrapper Class int Integer char Character double Double float Float boolean Boolean byte Byte short Short long Long Why Do We Need Wrapper […]

person shubham sharmaaccess_time November 23, 2024launch Read More

Why field injection is not recommended?

Field injection in Spring (or any Dependency Injection framework) is not recommended because it has several drawbacks compared to other types of injection like constructor injection or setter injection. Below are the key reasons why field injection is discouraged and best practices advocate avoiding it: 1. Harder to Test Issue: Field injection makes it difficult […]

person shubham sharmaaccess_time November 22, 2024launch Read More

What is @Transactional

@Transactional is an annotation in Spring Framework that provides declarative transaction management. It is used to define the transactional behavior of a method or class, ensuring that database operations within the annotated scope are executed as part of a single transaction. Key Features of @Transactional Atomicity: Ensures that all operations within a transaction are treated […]

person shubham sharmaaccess_time November 22, 2024launch Read More

Lambda Expressions

Here are several examples of lambda expressions in Kotlin to illustrate different use cases and syntactic styles. 1. Basic Lambda Expression A lambda expression is defined using curly braces {} with parameters and the arrow -> to separate parameters from the body.

2. Lambda as a Parameter in a Function Passing a lambda expression […]

person shubham sharmaaccess_time November 19, 2024launch Read More

Java interview questions 2

https://www.youtube.com/watch?v=9grEmpRfK0Y @Controller Vs @RestController How a spring boot application bootstraps? REST API Best practices Microservices interview questions Monolithic Architecture Vs Microservices Architecture How to manage IPs and servers in a microservices architecture How Service Discovery and Registration works? (A problem Scenario) How Client-side load balancing is different from Server-side load balancing? Is server-side load balancing […]

person shubham sharmaaccess_time November 18, 2024launch Read More

Java interview questions

https://www.youtube.com/watch?v=yX2w-Sof95s Q1. @component vs @service vs @repository Q2. What will happen if you will use @service over a DAO? Q3. Explain spring Bean Lifecycle Q4. How you will call the @PreDestroy marked methods in the standalone application. Q5. Explain the helper class that initializes and destroys the web application context. Q6. What are the RestClients […]

person shubham sharmaaccess_time November 18, 2024launch Read More

Spring Boot Key Question

Spring Boot Basics What is spring and spring boot Spring Boot Annotations List Spring Boot Lifecycle What is AutoConfiguration in Spring Boot and How to Override Spring Boot Core Concepts Dependency Injection in Context of Spring Boot What is Component Class What is Repository Class What is Service Class Difference Between Component, Service, Repository, Controller […]

person shubham sharmaaccess_time November 17, 2024launch Read More

jwt token

To implement JWT token-based authentication in Spring Boot with MongoDB as the user store, we need to follow these steps: Add Dependencies for MongoDB, Spring Security, JWT, and Spring Web. Create MongoDB User Model and Repository. Create a Service to manage user registration and authentication. Create JWT Utility for token generation and validation. Create JWT […]

person shubham sharmaaccess_time November 17, 2024launch Read More

jwt

To implement JWT (JSON Web Token) authentication in a Spring Boot application, follow these steps: 1. Add Required Dependencies Add the following dependencies to your pom.xml if you’re using Maven. These are essential for Spring Security and JWT handling:

2. Create a User Model You need to create a simple user model to hold […]

person shubham sharmaaccess_time November 17, 2024launch Read More

authentication and authorization

Authentication and Authorization: Key Concepts In the context of security, authentication and authorization are two fundamental concepts, but they serve different purposes and work together to protect resources and systems. Let’s explore each concept in detail: 1. Authentication Authentication is the process of verifying the identity of a user or entity (e.g., an application) attempting […]

person shubham sharmaaccess_time November 17, 2024launch Read More