0% found this document useful (0 votes)
0 views2 pages

Interview Java

Spring bean scopes define the lifecycle of beans in a Spring application, with Singleton being the default for stateless components. HTTP context scopes include Request, where a new bean instance is created for each HTTP request, and others like session and global. Spring Boot simplifies application development with auto-configuration, dependency management, and annotations for various layers like @Controller, @Service, and @Repository.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views2 pages

Interview Java

Spring bean scopes define the lifecycle of beans in a Spring application, with Singleton being the default for stateless components. HTTP context scopes include Request, where a new bean instance is created for each HTTP request, and others like session and global. Spring Boot simplifies application development with auto-configuration, dependency management, and annotations for various layers like @Controller, @Service, and @Repository.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

What are spring bean scopes?

Singleton(pattren)=> is the default scope which is the structure we use it if our application needs statelessness like
controller DAO

What are HTTP context scopes?

Request=> is where a new bean insance will be created for every http request

session=>

global=>

Why we use spring boot?

=> auto confuration - spring boot starters which is handling the version compatible-use jpa spring data to work with
orm(objet relational mapping) modules like hibernate we use dependecy-deployment using default server provied by
spring boot

we use dependecy data-jpa to create a data source for us automatically by using properties file

spring boot test anotation uses a spring extenstion to run our tests instad of using tipical Juint run our test we use
anotation test

@controller=>use for spring MVC web application to hanlde the HTTP requests

@restController=>is to mark that we use restful endpoints

@service=>for class that we put our logic the service layer

@Repository=>used to mark data layer or database(the dos)

@Bean =>is use to mark a method

@Autowired => tell the spring container that shoud be automatically

what is Spring Data?

makes easy to create the data access layer for our app

you do not have anymore to create data source(mean deal with sql directly and level api JDBC) and drivermanagersource
you just need to create a jpa entity class(we use anotation entity wich is from jpa and other like @id ) and interface that
exend the repository interface wich include or method crudRepository and some ohter like findall or findOne

we use with depandacy mysql connectorjava and depandacy datajpa

What is JPA=>java presistence api like jpa hibernate

Eager Lodaing is default which loading all data but Lazy loading fetch the data depend of what you want

Microservies=> divise a big project to small projects for easy coding and each meco service (small( project) not affecting
any other merco service(other small project)

and to communicate with each other we uising network calls through the APIs
Comminicate=> restful api calls and resful client using Resttemplate or feignClient this just for synchronous
communicattion

foy Asyn we use messaging like broker like ActiveMQ and kafta or Rabbit MQ (WITH MASSAGING HAVE ADVANTAGE OF
NOT BLOCKING)

Unit Testing =>is when ew focus on testing the corrent component and is fast

You might also like