vivanotes
vivanotes
Interface
Front controller--A front controller is defined as a controller that handles all requests for a Web Application.
DispatcherServlet servlet is the front controller in Spring MVC that intercepts every request and then
dispatches requests to an appropriate controller.
Configuration--@Configuration annotation indicates that a class declares one or more @Bean methods and
may be processed by the Spring container to generate bean definitions and service requests for those
beans at runtime
******What are the steps in implementing spring mvc with jpa--Video(Naveen reddy)******
Difference between post and put--PUT is meant as a a method for "uploading" stuff to a particular URI, or
overwriting what is already in that URI. POST, on the other hand, is a way of submitting data RELATED to a
given URI.
Methods of http--The primary or most commonly-used HTTP methods are POST, GET, PUT, PATCH, and
DELETE. These methods correspond to create, read, update, and delete (or CRUD) operations,
respectively. There are a number of other methods, too, but they are utilized less frequently
Advantages of JPA--that in JPA data is represented by classes and objects rather than by tables and
records as in JDBC
The life cycle of entity objects consists of four states: New, Managed, Removed and Detached. When an
entity object is initially created its state is New. In this state the object is not yet associated with an
EntityManager and has no representation in the database.
An entity object becomes Managed when it is persisted to the database via an EntityManager’s persist
method
A managed entity object can also be retrieved from the database and marked for deletion, using the
EntityManager’s remove method within an active transaction.
The last state, Detached, represents entity objects that have been disconnected from the EntityManager.
For instance, all the managed objects of an EntityManager become detached when the EntityManager is
closed.
maven ---->>>>>
Maven is a powerful project management tool that is based on POM (project object model). It is used for
projects build, dependency and documentation.
It simplifies the build process like ANT. ... In short terms we can tell maven is a tool that can be used for
building and managing any Java-based project.
Jpql vs SQL--->>>
The main difference between SQL and JPQL is that SQL works with relational database tables, records and
fields, whereas JPQL works with Java classes and objects.
For example, a JPQL query can retrieve and return entity objects rather than just field values from database
tables, as with SQL.
Spring security--->>>>
Spring Security is the primary choice for implementing application-level security in Spring applications.
Generally, its purpose is to offer you a highly customizable way of implementing authentication,
authorization, and protection against common attacks.
Ioc---->>>>
Spring IoC Container is the core of Spring Framework. It creates the objects, configures and assembles
their dependencies, manages their entire life cycle.
The Container uses Dependency Injection(DI) to manage the components that make up the application. ...
These objects are called Beans.
What is dispatchservelet?--->>>
The job of the DispatcherServlet is to take an incoming URI and find the right combination of handlers
(generally methods on Controller classes) and
views (generally JSPs) that combine to form the page or resource that's supposed to be found at that
location.
What is Junit?----->>>>
JUnit is an open source framework designed for the purpose of writing and running tests in the Java
programming language. ...
JUnit allows the developer to incrementally build test suites to measure progress and detect unintended
side effects. Tests can be run continuously.
Results are provided immediately.
What is final keyword?----The final keyword in java is used to restrict the user.If you make any variable as
final, you cannot change the value of final variable,If you make any method as final, you cannot override it,If
you make any class as final, you cannot extend it,
Is final method inherited?
Ans) Yes, final method is inherited but you cannot override it.
Collection---The Collection in Java is a framework that provides an architecture to store and manipulate the
group of objects.
pathvariable.....---the @PathVariable annotation can be used to handle template variables in the request
URI mapping
jpa directives...----JSP directives are the elements of a JSP source code that guide the web container on
how to translate the JSP page into it’s respective servlet.
Page directive
Include directive
Taglib directive
implicit objects-----These Objects are the Java objects that the JSP Container makes available to the
developers in each page and the developer can call them directly without being explicitly declared. ... JSP
Implicit Objects are also called pre-defined variables
Autowired--Autowiring feature of spring framework enables you to inject the object dependency implicitly. It
internally uses setter or constructor injection.
Autowiring can't be used to inject primitive and string values. It works with reference only
Controller and autocontroller---Controllers interpret user input and transform it into a model that is
represented to the user by the view. Spring implements a controller in a very abstract way, which enables
you to create a wide variety of controllers.
View resolver----Spring provides view resolvers, which enable you to render models in a browser without
tying you to a specific view technology
Functional interface---A functional interface is an interface that contains only one abstract method. They
can have only one functionality to exhibit. A functional interface can have any number of default methods.
Runnable, ActionListener, Comparable are some of the examples of functional interfaces.
Bean scope---In Spring, bean scope is used to decide which type of bean instance should be returned from
Spring container back to the caller.
2) Comparable affects the original class, i.e., the actual class is modified.
Comparator doesn't affect the original class, i.e., the actual class is not modified.
JSP directives ---The jsp directives are messages that tells the web container how to translate a JSP page
into the corresponding servlet.
There are three types of directives:
page directive
include directive
taglib directive
Implicit objects---These Objects are the Java objects that the JSP Container makes available to the
developers in each page and the developer can call them directly without being explicitly declared. ... JSP
Implicit Objects are also called pre-defined variables.
Serializable--Serializable is a marker interface your classes must implement if they are to be serialized and
deserialized. Java object serialization (writing) is done with the ObjectOutputStream and deserialization
(reading) is done with the ObjectInputStream.
how to validate the min. And max. Tickets in the scenario.. (this was the question in MCQs)
Session tracking and the ways which we can do session tracking.. how to do it in spring MVC..->>>>---
1-Session Tracking is a way to maintain state (data) of an user.
It is also known as session management in servlet. Http protocol is a stateless so we need to maintain state
using session tracking techniques.
Each time user requests to the server, server treats the request as the new request.
2-User Authentication.
HTML Hidden Field.
Cookies.
URL Rewriting.
Session Management API.
3-Using spring security you can implement session tracking and apply filters to validate requests. Spring
security is very easy to implement.
Uses of annotations--->>
Annotations are used to provide supplement information about a program. Annotations start with '@'.
Annotations do not change action of a compiled program.
Annotations help to associate metadata (information) to the program elements i.e. instance variables,
constructors, methods, classes, etc.
Custom exception--->>>>
Custom exceptions provide you the flexibility to add attributes and methods that are not part of a standard
Java exception. These can store additional information,
like an application-specific error code, or provide utility methods that can be used to handle or present the
exception to a user.
Multi threading---->>>>Multithreading is a model of program execution that allows for multiple threads to be
created within a process,
executing independently but concurrently sharing process resources. Depending on the hardware,
threads can run fully parallel if they are distributed to their own CPU core
@modelattribute anotation
@SessionaAttribute
@configuration
@componentscan
@controller and @restcontroller
@Atcontroller and @Requestmapping
Spring Rest
Spring security
View resolver
How do u handle Exceptions in spring