Oracle Java Interview Questions & Answers Set-16

«« Previous
Next »»

301) What is JoinPoint?
Ans: JoinPoint is any point in your program such as field access, method execution, exception handling etc.


302) Does spring framework support all JoinPoints?
Ans: No, spring framework supports method execution joinpoint only.


303) What is Advice?
Ans: Advice represents action taken by aspect.


304) What are the types of advice in AOP?
Ans: There are 5 types of advices in spring AOP.
  1. Before Advice
  2. After Advice
  3. After Returning Advice
  4. Throws Advice
  5. Around Advice

305) What is Pointcut?
Ans: Pointcut is expression language of Spring AOP.


306) What is Aspect?
Ans: Aspect is a class in spring AOP that contains advices and joinpoints.


307) What is Introduction?
Ans: Introduction represents introduction of new fields and methods for a type.


308) What is target object?
Ans: Target Object is a proxy object that is advised by one or more aspects.


309) What is interceptor?
Ans: Interceptor is a class like aspect that contains one advice only.


310) What is weaving?
Ans: Weaving is a process of linking aspect with other application.


311) Does spring perform weaving at compile time?
Ans: No, spring framework performs weaving at runtime.


312) What are the AOP implementation?
Ans: There are 3 AOP implementation.
  1. Spring AOP
  2. Apache AspectJ
  3. JBoss AOP

Spring MVC Interview Questions


313) What is the front controller class of Spring MVC?
Ans: The DispatcherServlet class works as the front controller in Spring MVC.


314) What does @Controller annotation?
Ans: The @Controller annotation marks the class as controller class. It is applied on the class.


315) What does @RequestMapping annotation?
Ans: The @RequestMapping annotation maps the request with the method. It is applied on the method.


316) What does the ViewResolver class?
Ans: The View Resolver class resolves the view component to be invoked for the request. It defines prefix and suffix properties to resolve the view component.


317) Which ViewResolver class is widely used?
Ans: The org.springframework.web.servlet.view.InternalResourceViewResolver class is widely used.


318) Does spring MVC provide validation support?
Ans: Yes.


319) How do you integrate Spring MVC with tiles?
Ans: Tiles helps us to define the layout for a web page. We can integrate Spring MVC with tiles by configuring TilesConfigurer and setting up appropriate view resolver.

    <bean id="tilesConfigurer"
    class="org.springframework.web.servlet.view.tiles2.TilesConfigurer"
    p:definitions="/WEB-INF/tiles-defs/templates.xml" />
    <bean id="tilesViewResolver"
    class="org.springframework.web.servlet.view.UrlBasedViewResolver"
    p:viewClass="org.springframework.web.servlet.view.tiles2.TilesView" />


320) Can you explain the concept of Interceptors in Spring MVC?
Ans: Handler interceptors are used when you want to apply specific functionality to certain requests. Handler Interceptors should implement the interface HandlerInterceptor.

Three methods are defined:

preHandle(..) is called before the actual handler is executed;
postHandle(..) is called after the handler is executed;
afterCompletion(..) is called after the complete request has finished.

«« Previous
Next »»