Thursday, March 2, 2017

Spring Interview Quetions

1.     What is dependency injection and what are the advantages?
2.     What is an interface and what are the advantages of making use of them in Java?
3.     What is meant by “application-context” and how do you create one?
4.     What is the concept of a “container” and what is its lifecycle?
5.     Dependency injection using Java configuration
6.     Dependency injection in XML, using constructor or setter injection
7.     Dependency injection using annotations (@Component, @Autowired)
8.     Component scanning, Stereotypes and Meta-Annotations
9.     Scopes for Spring beans. What is the default?
10.   What is an initialization method and how is it declared in a Spring bean?
11.     What is a destroy method, how is it declared and when is it called?
12.    What is a BeanFactoryPostProcessor and what is it used for?
13.    What is a BeanPostProcessor and how is the difference to a
14.      BeanFactoryPostProcessor? What do they do? When are they called?
15.        Are beans lazily or eagerly instantiated by default? How do you alter this behavior?
16.    What does component-scanning do?
17.    What is the behavior of the annotation @Autowired with regards to field injection,
18.     constructor injection and method injection?
19.      How does the @Qualifier annotation complement the use of @Autowired?
20.      What is the role of the @PostConstruct and @PreDestroy annotations? When will                   they get called?
22.         What is a proxy object and what are the two different types of proxies Spring can
              create?
24.      What is the power of a proxy object and where are the disadvantages?
25.    What are the limitations of these proxies (per type)?
26.     How do you inject scalar/literal values into Spring beans?
27.     How are you going to create a new instance of an ApplicationContext?
28.    What is a prefix?
29.        What is the lifecycle on an ApplicationContext?
30.      What does the "@Bean annotation do?
31.     How are you going to create an ApplicationContext in an integration test or a JUnit
                       test?
33.     What do you have to do, if you would like to inject something into a private field?
34.      What are the advantages of JavaConfig? What are the limitations?
35.     What is the default bean id if you only use "@Bean"?
36.       Can you use @Bean together with @Profile?
37.     What is Spring Expression Language (SpEL for short)?
38.     What is the environment abstraction in Spring?
39.     What can you reference using SpEL?
40.        How do you configure a profile. What are possible use cases where they might be
                   useful?
42.       How many profiles can you have?
43.    How do you enable JSR-250 annotations like @PostConstruct?
44.     Why are you not allowed to annotate a final class with @Configuration
45.       Why must you have a default constructor in your @Configuration annotated class?
46.    Why are you not allowed to annotate final methods with @Bean?
47.     What is the preferred way to close an application context?
48.    How can you create a shared application context in a JUnit test?
49.   What does a static @Bean method do?
50.    What is a ProperyPlaceholderConfigurer used for?
51.   What is @Value used for?

52.   What is the difference between $ a

No comments:

Post a Comment