0% found this document useful (0 votes)
5 views

Project-Document-COMS (1)

The document is an interview user guide that outlines key questions and answers for a software engineering position, focusing on the candidate's experience, current projects, technical architecture, security implementations, and deployment processes. It details the candidate's work with Java, microservices, Spring framework, and various tools for testing and CI/CD. Additionally, it addresses common challenges faced in projects and strategies for improving application performance and monitoring logs.

Uploaded by

Ajit gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Project-Document-COMS (1)

The document is an interview user guide that outlines key questions and answers for a software engineering position, focusing on the candidate's experience, current projects, technical architecture, security implementations, and deployment processes. It details the candidate's work with Java, microservices, Spring framework, and various tools for testing and CI/CD. Additionally, it addresses common challenges faced in projects and strategies for improving application performance and monitoring logs.

Uploaded by

Ajit gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

INTERVIEW USER GUIDE

Module – 1:

1. Tell me about yourself or May i know about your or can you briefly introduce about yourself?
Sol: we need to cover topics like Experience Companies (Current Company and past companies if you have), Technologies,
and Domains
 Hi this is Sreenu; I have completed my Btech from JNTU
 I am having 3+ years’ experience in java and j2ee technologies.
 Presently i am work as software engineer in TCS.
 During my experience i got the chance to work on different domains like telecom, banking and also
 I have worked on different technologies like jdk8, spring framework , spring boot , micro services,
distributedtechnologies using rest api and also hands-on on some real-time tools like
Git,maven,junit,mockito,powermockio,log4j,Jenkins

2. Can you explain about your current project?


Sol :
“Project name is COMS which is Card Offers Management System. The main objective of COMS product is to get the list of offers
for eligible customers, based on the usage of the card bank will provide the special offers to the customer. The offers categories
are membership offer, personalized offers, membership offers.”
Coms product has 4 modules
 batch processing module
 service module
 web module
 offers-admin module

What Spring Batch does?

1. Batch Job is used to execute the millions of the transactions per day without user interaction.
2. Here Batch job will get the list of offers from different sources and update into destination systems.
3. Generally batch jobs will be executed in non business (12:00 AM IST) without impacting customers txns.
4. Quartz scheduler - Cron expression: It is used to execute the batch job for the specified time interval.
5. Batch Job will read the data from mainframes and get the list of offer details of the
customer card number.
6. It will process the data like filter the data and remove the invalid records.
7. Write the resultant offer details into destination database.
8. This process will be continued every day without user interaction.

3. Can you explain your project architecture?

Sol: Architecture means how the different systems can communicate with each other.

Approach1: without micro services

1
Approach 2: with micro services

Note: There are 6 micro services has been developed for this COMS product
1. offer-details-service 2. customer-enrollment-service 3. Card-verify-service 4. User-Auth-Service service

Architecture Implementation Steps:


We have developed Rest API's using micro services architecture, if rest API will become as a micro service then it should follow
12 factors principles of micro services. As part of our project requirements, we have implemented few concepts in micro
service
Note :
Every microserivce will have its own (individual) git repositories. Here we have developed 5 micro services. i.e. 5 git
2
repositories. (no.of micro service = no. of git repositories), each micro services has single code base and single deployable
artifact.
1. Spring Cloud Config Server:
 All the properties files will be maintained in GIT repo
 If any changes required, we could update in properties file using config server it will be reflected into application code
i.e. without touching the source code of the application and deploy the application we can modify the properties files.
2. Eureka Server:
 It is used to register micro service instances.
 Eureka will expose rest API to communicate between micro services
 If the micro services instances will be changed then Eureka will take care to get the updated instance (Eureka server
api instance will not change). So that consumers will not impact to get the actual data from the micro services
3. Every Microservice will have single DB
4. Microservice should not dependent on other system
5. We have developed 6 Micro Services and deployed all into AWS EC2 using CICD pipeline
6. Each microservice has single code base repository
7. Configured CICD (Continuous Integration and Continuous Deployment) pipe line to enable auto build and deploy
theapplication.
8. Once service deployment has done then shared then configure all the service with API gateway and share the API gateway
swagger url to consumer.

9. Consumer/Client
 Consumers will be coming from web and mobile
 We are exposing secure services. i.e. using SSL (https)
 When the request will come from consumers to service ie. consumer will send the authorize token in request header
 Service will Authenticate by verify the token. If it is valid then redirect to actual service else, it will give error message
to consumer like 401 unauthorized client.
Microservice FAQs:
• Difference between monolithic and micro services?
• How to communicate/access from one micro service to another micro service?
• What is API gateway, how it works?
• How to trace the logs?
• How spring batch will work?
4. Can you explain your project technical flow?
Sol: we need to explain each and every class how it works. i.e. it should cover all the classes like controller, validator, service,
request builder, dao ,database integration, response handling, exceptions, response builder,
i.e. The flow should explain from client  microserivce service  backend systems

Based on the client requirements we have developed swagger documentation, since it is distributed application then we should
follow Layered Architecture. There are 3 layers

1. Controller Layer. 2. Service Layer or Business Layer 3. Integration Layer

3
1. Controller Layer: Get the request from consumer in json format and convert json to java object by JACKSON. Validate
the request, throws the exception if the request is invalid. Prepare the req for Service layer. Call the Service. If the
format is XML, then JAXB will take care to convert Java Object to XML and XML to java object
2. Service Layer: Get the request from controller layer and perform some business logic like data filtering,
transformation, implement parallel calls, aggregate the integrations data..etc
3. Integration Layer: It is used to communicate with backend systems. For every backend communication we need to
write corresponding client code.

Project Flow Explanation:


 Controller will Receive the json request from client
 Convert json request to java object
 Controller will call validator class to validate the request
 Once request is valid then controller will call service class
 In service class, we will call 2 intg layers in sequnetial way.
a. customer-enrollment-service-client : which will provide the credit score percentage
b. once will get success response from customer-enrollment-service-client then call dao

5. How are you implementing security in your project?


Sol :
Case 1: if you are not confident.
Explain like we have implemented different types security in our project like SSL, OAUTH 2.0 ..etc . But i didn’t get the chance
to work on this. My senior developer has implemented this. I know the theoretical process how the security works .

Case 2: if you are confident then explain as below

We have implemented different type’s security in our project like SSL, OAUTH 2.0

SSL: To implement this SSL we need JKS file and Password Client has provided these details.
We will share these details to network team; they will be configured JKS file at server level.
We will share public key to the entire consumer. They will be configuring at their approver level.
So that for every interaction between client and server will be transferred in encryption form.

Can you explain how it works SSL?


1. Validate certificate and Establish the Secure Connection so that transactions will be in secure (encrypted format)
2. Please go through the document ( document name : How SSL will work internally) which I have shared separately

Case 3: Implemented OAUTH 2.0 for authentication of the API’s


4
 Our Application was registered with Authorization server, we got client id , secret key from authorization server and
after registration was successful, Client has send the credentials, client ID, secret key to authorization server,
 Authorization server will validate the credentials, if the credential is valid then generate JWT token will send to client
and if the credentials are invalid then will get "401 unauthorized client"
 Now client has auth-token / bearer-token while invoking/calling to the api, they used to send auth_token in the
request header and API's will send the auth-token to auth-service to validate the token, if the token is valid then only
api will process the request else api will send error response like token invalid or token expired..etc.

Q) How authorization server will work?

Approach 1 : if you know answer then explain in below steps


1. spring boot has provided predefined annotation is called @EnableAuthorizationServer
2. It will expose 2 endpoints
a. /auth/token : This endpoint will expose validate the credentials and generate the token in JWT format
b. /auth/validate : This endpoint will validate the token, if the token is valid then decrypt the
tokenget the required details from token, send to client
Approach 2 : If you don’t know answer
1. I didn't get opportunity to work on auth-service, other team owned it.
2. They had provided swagger document of auth-service, using swagger document understand the
endpoint,request, response details
3. From our api's we are calling author-service endpoint like /author/validate, It will verify the token, if the token is
valid then it sent success response like customer ID, email id, role..etc else it would give error response like 500 token
expired or token invalid or ...etc

6. What are the problems/riks you have been faced in your project?

Problem 1: Spring scopes prototype is override by singleton


In my project we have used spring ioc for instantiating the beans. Starting we have implemented xml file configuration as per
architect suggestion we have moved to java config. While migrating we have forgot remove the entries in xml file.
<beans>
<context: component-scan basepackage="com.barclys"/>
<bean id="moffersTask" class="MoffersTask"/>
<bean id="poffersTask" class=" PoffersTask"/>
</beans>

Java Config :
@Component
@Scope("prototype")
public class CardTask {
}
@Component
@Scope("prototype")
public class PaymentTask {

We have implemented parallel calls in my project, unfortunately we didn’t close the threads because of this issue in production
servers will be down for every week, after more analysis we identify that issue with thread are not closed properly.

How to identify the issue?


Production support team will raise an incident and assign to dev team.
Seviority : Sev 1 IMR : Incident Management Req
5
Sev 1 IMR : Immediately Bridge opened . Every one related to project will be joined and resolve the issue within one hour.
Scenarios : Application is not working or not started db
Sev2 IMR :
we should accept the IMR with in 15 mins Need to resolve the issue in 2 days and
Do the changes in local and moved to dev and test environments. If it is working fine then only move the changes to
production.

Scenario: Application is working but for sometimes success and for sometimes getting 500 errors
Sev 3 IMR: Fix this issue. Move the changes to live in next 1 month

7. What are your roles and responsibilities in your project?

For <3 yr exp:


My Role is Developer and my responsibilities are mostly involved in development like writing the rest api using spring boot
and writing test cases using junit,mockito,powemockito, and also involved in supporting to testing team to fix the bugs.
For >= 3 yrs.
My Role is Sr.Developer and my responsibilities development and helping to team.
Everyday attending client calls to understanding project requirement and involved in develop writing rest apis using spring
boot, developed 3 micro service and writing test cases using junit,mockito,powemockito and also helping team if they will
struck anywhere and involved in supporting to testing team to fix the bugs.

8. How are you deploying the application or what is deployment process? (or)
How you will move the code from lower environment to higher environment (or)
How to move the code from dev to test and test to production?
Sol :
 We have developed the code and commit & push the code into GIT.
 Build all the maven modules into Jenkins. Jenkins will clone the source code from GIT
Perform the CI (Continues Integration) like
1. Compile the Code
2. Execute the unit test cases
3. Generate reports like code quality, code coverage using SonarQube
4. Execute security scanning
5. Generate the jar
6. Build the docker image
7. Push the docker image into docker hub/nexus
Perform the CD (Continuous Deployment) like
1. Jenkins will get the image from docker hub/nexus/Jfrog
2. Jenkins will deploy the image into dev environment, if dev environment is working as expected then deploy into test
environment. Similarly deploy into uat environment
3. Once Non prod is working fine then deploy the application into production environment

9. What are the testcase you have written in your project?


Sol : In our project we have used junit, mockito, powermockito to test our functionalities are working properly or not
 test card number valid or not
 test client id valid or not

6
 test offer details are coming or not
 test no offers found scenario?
 test list of transactions are coming or not
 test the transaction status
Can you write the snippet code?
@Test
Public void testCardNumber_Invalid_Scenario(){
---
Assert.assertEquals(--,--);
}
Questions on Junit,Mockito,PowerMockito?
 junit, mockito, powermockito?
 what is the tool you are using for code coverage? Sol : JACOCO
 what is the percentage for code coverage? 80%
Sol:
If our application will not have any backend then we can use only Junit is enough. So not required Mockito and Power Mockito.
If our application needs to communicate with backend, then using junit we cannot test all the scenarios. So that Code coverage
will be less.To improve the code coverage we should use Mockito
If already Mockito is there why you should use PowerMockito?
Sol: Actually, in our project we have used initially Mockito only.We have written some of the test cases using Mockito to mock
the external/back end systems.In some of the scenarios Mockito is unable to mock an object because of this issue we are
unable to test the all the scenarios. We did Google to resolve this issue then we came to know that PowerMockito can resolve
these issue. So we have implemented Power Mockito in our project.

10. How you will improve the application performance?


Use case : We have once legacy(Old) service which is calling 4 backend systems and currently it is taking 10 to 12 secs
response time, i would bring down from 10 sec to 1 or sec, what options can implement to reach 1 sec response time
|-backend system1
|-backend system2
offers-service==================> |-backend system3
|-backend system4
Solutions:
 Understand the architecture of the project
 Identifies how many components and how they are communicating
 Need to find the RCA (Root Cause Analysis) of the issue.
o is it issue with backend system, because of backends is giving more response then we are getting more
response
o is it issue with network
o is there sequential calls where really it is not required
o is there any duplicate calls, i.e. making service calls even though not used any more.
o is there any static data from backend systems
 Once RCA has been identified the fix the issues with below options
a. convert sequnetial calls into parallel calls
b. remove the duplicate or unused service calls
c. Implement caching to avoid too many backend calls, i.e. reduce network calls, cost save
d. we need to think how to optimize the source code by implementing best coding standards

7
11. Have you worked on parallel calls? Can you explain how it works?

Sol : Yes, we have worked on parallel calls . Please explain our poc stuff how the parallel calls will work

12. What is business logics you have implemented in the project?

Sol: In services layer what business logic we have implemented like, making sequential calls
based on credit score response, we were able to call proceed other service calls, once got the response
from other service calls then prepared final response

13. How are you monitoring logs? what tool you have used?

Sol : There are so many logging monitoring tools are there, some of them are ELK (kibana), SPLUNK, DataDog..etc
We have implemented ELK, using kibana dashboard to monitor the logs, based on logs alerts on errors
We will get the error logs and find the root cause of the issue and fix the issue.

14. How to debug and replicate the production issues?

Sol : If any issues will come in production then support team will inform to dev team with provided
necessary details like what date & time, what errors, how many errors ..etc. based on the details
dev team will search the logs in kibana or splunk and get the error logs.based on error logs try to
find the RCA (Root Cause Analysis)

Same error we should try to replicate in non production (Dev, Test), get the same error logs
Once we will fix those issues non prod, try to test it. If no errors found in non prod then only
move the changes into production.

15. Have you implemented Kafka in the project? Can you explain how it works?

Sol : Yes, we have implemented KAFKA in our project, implemented at publisher part
once the payment has been successful then push the customer details along payment details to KAFKA server
whoever subscriber they would pull the details from kafka server and process the request

Q. Can you explain the process?

Usecase 1:
We haven't implement Kafka in our current project, didn't get opportunity to implementbut i did
some poc on Kafka and helped to other project on implementation.
Usecase 2:
 Devops team or infra team setup the kafka cluster in AWS
 Shared the kafka server details like url, portnum, topic name, ..etc
 We have written kafka publisher client code and using KafkaTemplate push the changes into kafka server

Configuration class KafkaPublisher.java


==================== public class KafkaPublisher{
@Configuration
public class KafkaConfiguration { @Autowired
KafkaTemplate kafkaTemplate;
@Bean
public KafkaTemplate kafkaTemplate(){ public String sendMessage(String message){

8
return new KafkaTemplate(); kafkaTemplate.send(message);
} }

16. Have you implemented redis cache in the project? Can you explain how it works?

Sol:
Use case 1:
We haven't implement Redis cache in our current project, didn't get opportunity to implementbut
i did some poc on Redis cache and helped to other project on implementation.
Use case 2:
Yes, we have implemented Redis cache in our project to store all the customer transactions details , these
transacation will be not be changed in next 3 hours.
 We got the redis cache details from infra/devops team, using these details we can connect redis
server
 Configured these redis details like url, port, timeout, username..etc in application.properties file
 Added the spring-bootd-starter-data-redis dependency in pom.xml and configure cache
annotations like @EnableCaching and @Cacheble annotations in class and method levels
 Always the first request will goto backend systems and get the success response, store the
success into response into cache, from second request onwords first it will check data is present
in cache or not, if it is present get it from cache, else will goto backend to get the data.
17. What are the Linux commands you have used in your project?
Sol: To communicate with remote servers (Dev or test or prod ) which are deployed on Linux servers then we should use linux
commands using putty.
1. ls
2. cd
3. pwd
4. chmod -Rf 7777 filename
5. rm -Rf 777 filename
6. tail -f catalina.out
7. ./startup.sh
8 ./shutdown.sh
9. clear
10. cat filename

18. What is the tool you are using for code quality? Sol : Sonarqube

19. Can you explain SOLID design principles?

SOLID design principles: https://www.youtube.com/watch?v=oMQtcVMFbn8


SRP: Single Responsible Principle
OCP: Open, Closed Principle
LSP: Liskov Substitution Principle
ISP: Interface Segregation Principle
DIP: Dependency Injection Principle

9
Module 2:
1. Core java : Logical Questions using jdk8 stream api
I have a List Employees, each employee has empid, name, salary, location, dob..etc
a. how to get the Hyderabad location employee details
b. how to sort the employees based on emp name or salary
c. how to get max salary emp details or how to get Nth ( 2nd or 3rd ) salary emp details
d. who is the highest salary emp of each location
2. What are the collections (List or Set or Map) you have used in the project? Can you write skeleton code?
3. What is polymorphism? Have you used in the project? Write Skelton code?
4. What is encapsulation? have you used in the project? Write Skelton code?
5. What is the different String, StringBuffer, and StirngBuilder?
6. Can you explain how you have handled exceptions in your project and write the snippet code?
Sol: Generally, to implement exceptions in our we should use custom exceptions or use defined exceptions. According to client
requirement. We have categorized custom exceptions into different kind of exceptions
1. RequestInvalidException
2. BusinessException
3. SystemException
4. UnknownErrorException
Can you write snippet code how to write custom exception?
Public class RequestInvalidException extends Exception {
Private String errorCode;
Private String errorMsg;
Public ReqInvalidException (String errorCode,String errorMsg){
this.errorCode= errorCode;
this.errorMsg =errorMsg;
}//getters
}

Exception VS RuntimeException :
==============================
Exception: It is checked exception, which are enabled at compile time Runtime Exception: It is unchecked exception, which are
enabled at runtime. Note: either checked or unchecked exceptions will be raised at runtime only
Q) Difference between try, catch and throws
Q) Difference between throws and throws

Q) What are the codes you have written in finally block?


Sol: logging-- to print the complete status of the request
Q) Is it possible to handle the exception without try and catch?
Sol: yes, we can do
In case of Spring using @ExceptionHandler annotation we can implement.
@ExceptionHanlder will be configured in@ControllerAdvice class.
@ControllerAdvice
public class OffersControllerAdvice{
@ExceptionHandler(value= RequestInvalidException.class)
@ResponseBody
Public OffersResponse handleReqInvalidException(RequestInvalidException exe){
//prepare the error response
}
}
8. What are the exceptions you have faced during project development? and deployment?
Sol: During development we have faced exceptions like NullPointerException, ClassNotFoundException,
10
BeanInstanceCreationException, and IllegalArgumentException.
During deployment we have faced exceptions like OutofMemory error,
1. Heap dumps (temporary) file : These files will be created by remote os
day to day these files size will be increased. In dev server we will delete the heap dumps by login into putty using dev server
ipaddress, username,pwd
$temp>rm -rf *
2. More applications deployed in remote server:
The applications size more than remote server size then we will try delete the unused application by getting permission from
owner of the application
3. If the issue is still not resolved, then raise the incident to network team they will be fix the issue.

9. What is polymorphism? Where you have used in project?


Sol : Single task may perform many operations.
1. static ( method over loading ) 2. dynamic (method overriding )
In our project we have used method overloading, writing 2 or more methods in a class. Method name is same but arguments
are different.
Can you explain your project scenario? And write the snippet code?
Sol : In our project to build the response we are writing 2 methods with same name one is for to build success response
another one to build the failure response.

Public OffersResponse buildOffersResponse (EnrollmentServiceClientResp enrollmentServiceClientResp,


OffersDaoResponse daoResponse) {

}
Public OffersResponse buildOffersResponse (String errorCode, String errormsg) {
------------
}
10. What is encapsulation? Where have you used in project?
Sol: Encapsulation: Data hiding + Abstraction
Data hiding: By declaring all the member variables as private in a class.
Abstraction: Hide the implementation details.
Public class Account {
Private int amount;
Public void setAmount(String amount){ if( amount > 100 ){
this.amount = amount;
}
}
In our project we have used to create the beans like DTO,VO.These beans we have applied Encapsulation.
11. What are the collections you have used in project?
Sol : In our project we have used List and Map
Map : To invoke the stored procedure using spring jdbc. Here execute() method will expect argument input and output as map.
 Can you write snippet code how you implement in the project?
 How to insert and retrieve the values in Map?
 How HashMap internally will work?
List : We are getting list of products from database, to process these products we have used List
 How List is internally will work?
 Can you write our own ArrayList?How it is ?
 Can you write List snippet code how you have used in project?
12. What are the day to day activities in your office?
1. Our office official timings: 9:00 AM to 6:00 PM
11
2. We will reach office @ 9 or 9:30 AM.
3. First will check the client emails .So we came to know that what work we need to do.
4. Attending the scrum call or onshore status call @10:00 AM This will be around 10:00 AM to 10:30 AM
I will get clarify if any doubts in call.
5. Will go for tea break 10:15 AM to 10 :45 AM
6. I will start project work and continue until 1 or 1:30 PM
7. Will go for lunch 1 hour 1:30 PM to 2:30 PM
8. Start work from 2:30 PM to 4:30 PM .
9. Tea break 15 mins
10. Start work from 4:45 PM to 6 :30 PM or 7:00 PM
11. Before leave office sent status mail to onshore team.

12. Rest API Best practices


Sol:
a. Endpoint name should be noun instead of verb
i. Ex: /createCustomer: /customer + POST
ii. /getCustomer : /customer + GET
b. Maintain API versioning: /v1/customer
c. Content-Type in response header
d. Use Status Codes in Error Handling
i. 200 – success
ii. 201 – success with no records
iii. 400 – bad request
iv. 401 – unauthorized client
v. 403 – method not supported
vi. 404 – resource not found
vii. 500 – internal server error
viii. 503 – gateway error
e. Implement HATEOAS – Nesting on endpoints to show relationships
f. Use Filtering, Sorting, Pagination to retrieve data requested
g. Use SSL for security
h. API Documentation like Swagger
13.

==================================Micro Service ===========================================


1. What is micro Service ?
2. Difference between monolithic and micro services?
3. Without restart server, how to changes should be reflected into microservice?
Sol : Config Server
4. What is service discovery or Eureka Server?
5. How to communicate between micro services
1. Discovery Client 2. Ribbon Client 3. Fiegn Client
@Autowired
private DiscoveryClient discoveryClient;
List<ServiceInstance> instances = discoveryClient.getInstances("carddetails-service");

String serviceBaseUrl = instances.get(0).getUri().toString();


6. How to handle exceptions in micro service?
Sol : zipkin, slueth --- to generate traceid , carry this traceid to all the micro services

12
=============================Spring Core===================================================
1. What is Spring Framework? What are it's main modules? What are the benefits of using Spring Framework?
2. What are some of the important features of spring framework? What is Inversion of Control (IoC) ?
3. What are the important roles of an IOC Container? what is Dependency Injection(DI)?
4. How do we implement DI in Spring Framework? Difference between Spring IOC and DI?
5. What is Loose Coupling?
6. What are types of IoC containers?
7. How to create Application Context in a Java Program? Difference between Bean Factory and Application Context?
What is a Spring Bean?
8. What is the importance of Spring bean configuration file? What are different ways to configure a class as Spring Bean?
What is Spring XML-Based Configuration?
9. What is Spring Java-Based Configuration?
10. What is Spring Annotation-based Configuration?
11. Can we have multiple Spring configuration files in one project? what are the different ways of injecting spring beans?
12. Which is the best way of injecting beans and why? Are singleton beans thread-safe?
13. Does Spring Bean provide thread safety? Explain Spring Bean lifecycle?
14. What are different Spring Bean Scopes? What are inner beans in Spring?
15. How to inject a java.util.Properties into a Spring Bean? What is Bean wiring?
16. Explain Spring Bean Autowiring?
17. Explain different modes of bean autowiring?
18. How do you turn on annotation based autowiring? Explain @Required annotation with example?
19. Explain @Autowired annotation with example?
20. Name some of the Design Patterns used in the Spring Framework? How does the scope Prototype work?
21. What Spring sub-projects do you know? Describe them briefly? Explain @Qualifier annotation with example?
22. Difference between constructor injection and setter injection? What are the different types of events in spring
framework?
23. Difference between FileSystemResource and ClassPathResource?
24. Which Dependency Inject would you suggest Constructor-based or setter-based?
25. How do you inject values into collection types List, Set, Map and Properties in a Spring bean? What are the types of
the transaction management Spring supports?
26. How is event handling done in Spring and what are the different types of events in spring framework? How do you
create an application context with Spring?
27. How does Spring know where to search for Components or Beans? What is a Component Scan?
28. How do you define a component scan in XML and Java Configurations? What does @Component signify?
29. What’s the difference Between @Controller, @Component, @Repository, and @Service Annotations in Spring?
30. How do you choose between setter and constructor injections?
31. What are the different options available to create Application Contexts for Spring? What are the different kinds of
matching used by Spring for Auto wiring?
32. How do you solve NoUniqueBeanDefinitionException? How do you solve NoSuchBeanDefinitionException?
33. What is @Primary? What is @Qualifier?
34. What are new features in Spring Framework 4.0? What are new features in Spring Framework 5.0?
35. What is the simplest way of ensuring that we are using single version of all Spring related dependencies? Why is Spring
Popular?
36. Which steps of beans life-cycle can be overridden or controlled?
37. What is a Spring Bean Factory? What are some of the implementations available?
38. In the context of Spring, what is a “stereotype”? What are the existing stereotypes and what is the difference between
them?
39. What are the different components of a Spring application? What are the various ways of using Spring Framework?

40. How configuration metadata is provided to the Spring container?


41. What are the limitations with auto wiring?
42. Explain the Core Container (Application context) module?
13
43. What are the common implementations of the ApplicationContext? Can you inject null and empty string values in
Spring?
44. What would happen if we have a prototype bean injected into a singleton bean ? How many objects of prototype bean
object will be created ?
45. ex:
46. <bean id="requestProcessor" class="com.card.citi.RequestProcessor">
47. <property name="validator" ref="validator"/>
48. </bean>
49. <bean id="validator" scope="prototype" class="com.card.citi.RequestValidator"/>

50. Are singleton beans in Spring a regular singleton object ?


51. A bean can be marked abstract by abstract=true, does not that mean we have to make the corresponding java class
abstract ?
52. If an inner bean is defined with an id, can you use this id to fetch the bean from the container ? What is the
implementation of List is used when you use the <list> tag in a bean definition ?
53. How do you use a particular implementation of collection in your bean definition ? how do you load the properties
into spring configuration file?
54. What Does A Bean Definition Contain?
55. How Do Add A Bean In Spring Application and give an example? Explain @PostConstruct, @PreDestroy and @Resource
annotations? How Is Event Handling Done In Spring?
56. Describe Some Of The Standard Spring Events?
57. How You have implemented spring IOC in your project?

=================================SpringMvc======================================
1. What is Spring MVC framework?
2. What is DispatcherServlet and ContextLoaderListener?
3. Explain Spring MVC Flow or Can you explain How one request is processed? What is the front controller class of Spring
MVC?
4. How do you create a controller in Spring? @Controller vs @RestController? What is the difference in Spring MVC and
Spring core?
5. What are different implementations of View interface you have used in Spring MVC?
6. MVC is an abbreviation for a design pattern. What does it stand for and what is the idea behind it? How to use Java
based configuration?
7. How can we use Spring to create Restful Web Service returning JSON response? Can we have multiple Spring
configuration files?
8. Difference between <context:annotation-config> vs <context:component-scan>? Difference between @Component,
@Controller, @Repository & @Service annotations?
9. What does the ViewResolver class?
10. What is a MultipartResolver and when its used? How to upload file in Spring MVC Application? How does Spring MVC
provide validation support?
11. How to validate form data in Spring Web MVC Framework? What is Spring MVC Interceptor and how to use it?
12. How to handle exceptions in Spring MVC Framework? How to achieve localization in Spring MVC applications?
13. How to get ServletContext and ServletConfig object in a Spring Bean? How to use Tomcat JNDI DataSource in Spring
Web Application?
14. How would you relate Spring MVC Framework to 3-tier architecture? Is the DispatcherServlet instantiated via an
application context?
15. What is the root application context? How is it loaded?
16. What is the @Controller annotation used for? How can you create a controller without an annotation? What is the
ContextLoaderListener and what does it do?
17. What are you going to do in the web.xml. Where do you place it?

18. How is an incoming request mapped to a controller and mapped to a method? What is the @RequestParam used for?
14
19. What are the differences between @RequestParam and @PathVariable? What are some of the valid return types of a
controller method?
20. What is a View and what’s the idea behind supporting different types of View? How is the right View chosen when it
comes to the rendering phase?
21. What is the Model?
22. Why do you have access to the model in your View? Where does it come from? What is the purpose of the session
scope?
23. What is the default scope in the web context? Why are controllers testable artifacts?
24. What does the InternalResourceViewResolver do? What’s internal resource views?
=====Spring boot=================
1. What is Spring Boot?
2. Why we need Spring Boot?
3. What are the advantages of using Spring Boot? What are the disadvantages of using Spring Boot? What is Spring Boot
Starter?
4. What is spring-boot-starter-parent? What is spring-boot-starter-web?
5. How do you run and stop spring boot executable jar? How to disable specific auto-configuration in spring boot?
6. Why is it “opinionated”?
7. How does it work? How does it know what to configure? How are properties defined? Where?
8. What is Spring Boot CLI?
9. Spring Boot Components?
10. What is Spring Boot Starter?
11. What is Spring Boot AutoConfigurator? What is Spring Boot Initilizer?
12. What is the difference between an embedded container and a WAR? What embedded containers does Spring Boot
support?
13. What does @EnableAutoConfiguration do? What about @SpringBootApplication? What is a Spring Boot starter POM?
Why is it useful?
14. Spring Boot supports both Java properties and YML files. Would you recognize and understand them if you saw them?
15. Can you control logging with Spring Boot? How?
16. How to reload my changes on Spring Boot without having to restart server? What is Actuator in Spring Boot?
17. How to run Spring boot application to custom port? How to implement security for Spring boot application?
18. What is the configuration file name used by Spring Boot? How to implement Spring web using Spring boot?
19. How to configure database using Spring boot? What is YAML?
20. What are the advantages of YAML file than Properties file? What are the different ways to load YAML file in Spring
boot? What are the advantages of spring Externalized Configuration? What are Profiles in spring boot?
21. How to write custom log configuration in spring boot?
22. How do you customize Favicon in spring boot web application? How spring boot handles error in application?
23. How do you Create a deployable war file in spring boot? What is Hot swapping in spring boot?
24. How to execute Spring Batch jobs on startup?
25. Does spring boot need Logging? What is the default one? How do you configure Configure Logback for logging?
26. How do you Configure Log4j for logging?
27. How do you write a Write a JSON REST service in spring boot? How do you Write an XML REST service in spring boot?
28. What is the default Multipart File Uploads size in spring boot? How do you Enable HTTP response compression in
spring boot? How do you add Add a Servlet, Filter or Listener to an application ?
29. How do you Switch off the Spring Boot security configuration? What is “Transitively Dependency Resolution
Management”? What is spring-boot-devtools ?
30. How do you Change tomcat or jetty HTTP port? What is LiveReload?
31. How to exclude auto restart for static files?
32. ========Spring AOP=====
33. What is the concept of AOP? Which problem does it solve?
34. What is a pointcut, a join point, an advice, an aspect, weaving, Introduction, Target Object, AOP Proxy? How does
Spring solve (implement) a cross cutting concern?
35. Which are the limitations of the two proxy-types?
15
36. How many advice types does Spring support. What are they used for?
37. What do you have to do to enable the detection of the @Aspect annotation? Name three typical cross cutting
concerns?
38. What two problems arise if you don’t solve a cross cutting concern via AOP? What does @EnableAspectJAutoProxy
do?
39. What is a named pointcut?
40. How do you externalize pointcuts? What is the advantage of doing this? What is the JoinPoint argument used for?
41. What is a ProceedingJoinPoint?
42. What are the five advice types called?
43. Which advice do you have to use if you would like to try and catch exceptions? Limitations of Spring AOP?
44. What are the supported AspectJ pointcut designators in Spring AOP? How to declare aspect in Spring AOP?
45. How to declare a pointcut in Spring AOP?
46. What do you understand by Load-time weaving (LTW) in Spring?

=======Spring Batch ===============


1. Explain spring batch framework? When to use Spring Batch?
2. Explain the Spring Batch framework architecture?
3. What is difference between Step, Tasklet and Chunk in Spring Batch? How you implemented Spring Batch Tasklet?
What was the use case? How to configure Spring Batch with Spring boot?
4. What is Tasklet in Spring Batch?
5. How can we schedule a Spring Batch Job?

16

You might also like