Spring Framework

Q1. How filters are used in Spring Web?

Q2. How is a resource defined in the context of a REST service?

Q3. Which of these is a valid Advice annotation?

Q4. What does a ViewResolver do?

Q5. How are Spring Data repositories implemented by Spring at runtime?

Q6. What is SpEL and how is it used in Spring?

Q7. The process of linking aspects with other objects to create an advised object is called

Q8. How are JDK Dynamic proxies and CGLIB proxies used in Spring?

Q9. Which of these is not a valid method on the JoinPoint interface?

Q10. In what order do the @PostConstruct annotated method, the init-method parameter method on beans and the afterPropertiesSet() method execute?

Q11. What is the function of the @Transactional annotation at the class level?

Q12. Which is a valid example of the output from this code (ignoring logging statements) ?

public class App {
     public static void main(String args[]) {
, args);

public class Print implements InitializingBean {
     public void afterPropertiesSet() throws Exception {

Q13. Which println statement would you remove to stop this code throwing a null pointer exception?

public class Test implements InitializingBean {
     ApplicationContext context;
     static SimpleDateFormt formatter;

     public void afterPropertiesSet() throws Exception {
          System.out.println(context.containsBean("formatter") + " ");

class TestConfig {
     public SimpleDateFormat formatter() {
          return new SimpleDateFormat();

Q14. What is the root interface for accessing a Spring bean container?

Q15. Which annotation can be used within Spring Security to apply method level security?

Q16. What is the result of calling the map controller method using the HTTP request GET localhost:8080/map?foo=foo&bar=bar ?

public class SampleController {

     public String map(@RequestParam("bar") String foo, @RequestParam("foo") String bar) {
          return bar + foo;

Q17. What is the purpose of the @Lazy annotation and why would you use it?

Q18. What is dependency injection?

Q19. What is a RESTful web service?

Q20. What happens when a class is annotated with the @Controller annotation?

Q21. Which property can be used to change the port of a Spring application?

Q22. What is the purpose of the @ResponseBody annotation?

Q23. How are mocking frameworks such as Mockito used with Spring?

Q24. What is the name of the central servlet that dispatches requests to controllers?

Q25. What is the purpose of the Spring IoC (Inversion of Control) container?

Q26. What is component scanning?

Q27. What does @SpringBootApplication do?

Q28. How does Spring Data facilitate queries against a datastore?

Q29. How does Spring generate bean names for classes annotated with @Component that do not specify a name?

Q30. What is the delegating filter proxy?

Q31. What value does Spring Boot Actuator provide?

Q32. What is the purpose of the @ContextConfiguration annotation in a JUnit Test?

Q33. How are authentication and authorization different?

Q34. What is the purpose of the @RequestBody annotation?

Q35. What is the DispatcherServlet and what is its function?

Q36. What is Spring Boot autoconfiguration?

Q37. Which are valid steps to take to enable JPA in Spring Boot?

Q38. What is a transaction in the context of Spring Data?

Q39. Modularization of a concern that cuts across multiple classes is known as a(n)___.

Q40. How do you inject a dependency into a Spring bean?

Q41. Consider the properties file How would you load the property
private String val;
private String val;
private String val;
private String val;