Java Spring Multiple Choice Questions & Answers (MCQs) on “Securing and persisting objects in Web Flows”.
1. Element which secures web flows.
a) secured
b) security
c) sec
d) none of the mentioned
Answer: a
Clarification: With Spring Security configured properly, you can simply secure a flow, a state, or a transition by embedding the secured element with required access attributes specified.
2. To secure web flows with Spring Security.
a) DelegatingFilter
b) DelegatingFilterProxy
c) DelegatingProxy
d) None of the mentioned
Answer: b
Clarification: To secure web flows with Spring Security, you first have to configure a DelegatingFilterProxy filter in the web deployment descriptor (i.e., web.xml).
3. Group id to add spring security using Maven.
<dependency> <groupId>groupId> <artifactId>spring-security-coreartifactId> <version>3.0.2.RELEASEversion> dependency>
a) org.springframework.secure
b) org.springframework.security
c) org.springframework.securedflow
d) none of the mentioned
Answer: b
Clarification: org.springframework.secur is used to secure web flows with Spring Security.
4. auto-config provides only default form-based login service.
a) True
b) False
Answer: b
Clarification: HTTP auto-config, which provides a default form-based login service, an anonymous login service, and so on.
5. To enable Spring security for web flows.
a) SecurityFlowExecutionListener
b) SecurityFlowExecution
c) FlowSecurity
d) SecurityFlowListener
Answer: a
Clarification: You have to register the flow execution listener SecurityFlowExecutionListener in the flow executor to enable Spring Security for web flow.
6. Which of the following class should replace ‘?’.
<beans ...> ... <webflow:flow-executor id="flowExecutor"> <webflow:flow-execution-listeners> <webflow:listener ref="securityFlowExecutionListener" /> webflow:flow-execution-listeners> webflow:flow-executor> <bean id="securityFlowExecutionListener" class="?" /> beans>
a) org.springframework.webflow.security.SecurityFlow
b) org.springframework.webflow.SecurityFlowExecutionListener
c) org.springframework.webflow.security.SecurityFlowExecutionListener
d) org.springframework.security.SecurityFlowExecutionListener
Answer: c
Clarification: You have to register the flow execution listener SecurityFlowExecutionListener in the flow executor to enable Spring Security for web flow.
7. Which attribute is used to access security element of web flow.
a) attribute
b) attributes-security
c) attributes
d) none of the mentioned
Answer: c
Clarification: You can specify multiple access attributes required for accessing this web flow in the attributes attribute, separated by commas.
8. Spring web flow supports integration with.
a) JSF
b) Hibernate
c) JPA
d) All of the mentioned
Answer: d
Clarification: Spring Web Flow 2.0 comes with support for JPA and Hibernate.
9. To integrate JPA with Spring Web flows.
a) JpaFlowExecutionListener
b) HibernateFlowExecutionListener
c) All of the mentioned
d) None of the mentioned
Answer: a
Clarification: To have Spring Web Flow manage the persistence contexts for your web flows, you have to register a flow execution listener (e.g., JpaFlowExecutionListener for JPA.
10. To integrate Hibernate with Spring Web flows.
a) JpaFlowExecutionListener
b) HibernateFlowExecutionListener
c) All of the mentioned
d) None of the mentioned
Answer: b
Clarification: To have Spring Web Flow manage the persistence contexts for your web flows, you have to register a flow execution listener (e.g., HibernateFlowExecutionListener for Hibernate.
11. HibernateFlowExecutionListener and JpaFlowExecutionListener both belongs to which of the package.
a) org.springframework.web.persistence package
b) org.springframework.persistence package
c) org.springframework.webflow package package
d) org.springframework.webflow.persistence package
Answer: d
Clarification: JpaFlowExecutionListener for JPA and HibernateFlowExecutionListener for Hibernate, both of which belong to the org.springframework.webflow.persistence package) in the flow executor.
12. JpaFlowExecutionListener and Hibernate Listener binds to flow scope.
a) True
b) False
Answer: a
Clarification: . When a new flow starts, this listener creates a new persistence context (e.g., a JPA entity manager or a Hibernate session) and binds it to the flow scope.
13. Libraries used to integrate Hibernate with JPA.
a) Hibernate 3
b) Hibernate 3 Entity Manager
c) JPA API
d) All of the mentioned
Answer: d
Clarification: To use Hibernate as the JPA engine, you have to add Hibernate 3, the Hibernate 3 EntityManager, the JPA API, and ehcache.
14. To configure JPA vendor-specific information.
a) JPA vendor adaptor
b) Data source
c) All of the mentioned
d) None of the mentioned
Answer: c
Clarification: you can configure a JPA entity manage factory by providing a data source and a JPA vendor adaptor, where you can configure JPA vendor-specific information.
15. You have to register a flow execution listener in the flow executor.
a) True
b) False
Answer: a
Clarification: To have Spring Web Flow manage the persistence contexts for your web flows, you have to register a flow execution listener in the flow executor.