Beruflich Dokumente
Kultur Dokumente
Q8. What are the right affirmations about the @PostConstruct, @Resource and the @PreDestroy
annotations?
1. Those annotations are specified in the JSR-250
2. The Spring Framework embedded those annotation
3. The <context:annotation-config/>tag enable them
4. All are correct
Q9. Select one or many correct answers about spring bean life cycle.
1. The method annoted with @PostConstruct is called after bean instantiation and before
properties setting of the bean
2. The method @PreDestroy of a prototype bean is called when the bean is garbage collected
3. The init() method declared in the init-method attribute of a bean is called before the
afterPropertiesSet callback method of the InitializingBean interface
4. The method annotated with @PostConstruct is called before the afterPropertiesSet
callback method of the InitializingBean interface
Q10. What is/are typically case(s) where you usually need to manually instanciated an ApplicationContext?
1. In a web application
2. In an integration test running with the SpringJUnit4ClassRunner
3. In a standalone application started with a main method
4. None of the above
Q12 BeanFactory instantiates beans lazily i.e. Beans are instantiated when you get them from BeanFactory not on
loading BeanFactory.
1. True
2. False
Q13. Spring framework support:
1. Constructor injection
2. Setter injection
3. Interface injection
4. All of these
Q14. Default bean scope in spring freamework
1. singleton
2. prototype
3. request
4. session
Q15. Consider
@Controller
public final class RosterController {
private List<Member> members = new ArrayList<Member>();
@RequestMapping
public void list(Model model) {
model.addAttribute(members);// 1
}}
1. it is error as no key is provided while putting value members into model map
2. it will compile with will give error at run time
3. we don’t required to put key into model map, it is gussed to memberList
4. none of these
Q16.
Consider
@Controller
public final class RosterController {
private List<Member> members = new ArrayList<Member>();
@RequestMapping
public void list(Model model) { //1
model.addAttribute(members);
}}
1. byName
2. byType
3. constructor
Q18.______________ Marker superinterface indicating that a bean is eligible to be notified by the Spring container of
a particular framework object through a callback-style method.
1. Aware interface
2. AbstractAware interface
3. BeanNameAware
4. BeanFactoryAware
Q19. What is the best approach for applying bean life cycle methods (We want to insulate from spring framework in
our code)
1. Use aInitializingBean, DisposableBean
2. Use @PreConstruct and @PostConstruct method
3. Using < beaan …..init-method="myInit" destroy-method="cleanUp"/>
4. None of these
Q20. Consider following code snipshot
<bean id="t1" class="com.ex7.Traveler">
<property name="travelerName" value="#{'raj'}"/>
<property name="vehical" ref="#{v}"/>
</bean>
<bean id="v" class="com.ex7.Car"/>
Q22. How to reload my changes on Spring Boot without having to restart server?
1. put spring jpa dependencies
2. put spring monitoring dependencies
3. put spring Actuator dependencies
4. put spring devTools dependencies
Q23. Servlet filter registered in web deployment descriptor, which filters request in spring application context.
a) DelegatingFilter
b) DelegatingFilterProxy
c) DelegatingProxy
d) None of the mentioned
Q24. Filter chain configured by Spring security, when web app security enabled.
a) springSecurityFilterChain
b) delegatingFilterProxy
c) none of the mentioned
d) all of the mentioned
Q25. Class which declares a number of overloaded update() template methods to control the overall update process.
a) org.springframework.jdbc.core.JdbcTemplate
b) org.springframework.jdbc.core.*
c) org.springframework.jdbc.*
d) none of the mentioned