Spring Flashcards
What is Spring?
An open-source application framework that provides infrastructure support for developing Java applications. It helps developers create high performing applications using Java. It uses inversion of control (IOC) to turn control of the code to the framework, using dependency injection. This improves speed and efficiency in app development
What is dependency injection in Spring?
A technique to provide the objects that an object needs (its dependencies) instead of having it construct them itself. There are 3 types: Method (aka interface based), setter (aka property), and constructor injection.
What are Spring Beans?
Uniquely identified objects that are instantiated, assembled, and managed by the Spring IOC container. Basically, classes that encapsulate many objects into a single object. They function by means of annotations, like @ComponentScan which tells Spring where in the container to find the beans
What is application context?
The central interface that is responsible for instantiating, configuring, and assembling the beans in the Spring ioc container. It performs the same functions as the BeanFactory with the additions of MessageSource, access to resources, event propagation to beans, loading multiple contexts, etc.
Explain Application.Properties file
A collection of key:value pairs that represent configuration options and their underlying values in your project. Replaces all XML configuration.
What is Spring ORM?
Object Relational Mapping. A technique or design pattern used to access a relational database from an object-oriented language. It covers many persistence technologies including JPA (Java Persistence API) which is mainly used to persist data between Java objects and relational databases; Hibernate, Java Data Objects (JDO), and iBATIS SQL Maps
What is JPA?
Java Persistence API. A specification that defines how to persist data in Java applications. The primary focus of JPA is the ORM layer and is used to examine, control, and persist data between Java objects and relational databases.
Being just a specification, JPA consists of a set of interfaces, like EntityManagerFactory, EntityManager, and annotations that help you map a Java entity object to a database table.
There are several JPA providers, like Hibernate, EclipseLink, or Open JPA which you can use.
What is Hibernate?
Hibernate is an open source object relational mapping (ORM) tool that provides a framework to map object-oriented domain models to relational databases for web applications. ORM is based on the containerization of objects and the abstraction that provides that capacity. Abstraction makes it possible to address, access and manipulate objects without having to consider how they are related to their data sources.
Any changes made are encapsulated in the data source itself, so that when those sources or their application programming interfaces (APIs) change, the applications that use ORM don’t have to make changes or even be aware of that information.
Spring Data JPA vs JPA
Spring Data JPA is part of the umbrella Spring Data project that makes it easier to implement JPA based repositories. Provides a definition to implement repositories that are supported under the hood by referencing the JPA specification, using the provider you define.