Spring Programming Flashcards
Do you need to define any dependencies in order to use beans from one extension in the other extension?
If yes, where?
- There is no need to define any dependencies
- All beans can be accessed with or without defining dependencies
- Extensioninfo.xml
- Localextensions.xml
- Extensioninfo.xml
- Localextensions.xml
What is the default bean scope if bean scope is not defined?
- session
- request
- tenant
- singleton
singleton
How the GenericApplicationContext is constructed and when is it loaded?
- Is constructed using all configuration files of all the extensions by start-up time and is loaded during hybris startup
- Is constructed using configuration files of the platform core extensions by start-up time and is loaded when you run a hybris build
- Is constructed using all configuration files of all the extensions by start-up time and is loaded when you run a hybris build
- Is constructed using configuration files of the platform core extensions by start-up time and is loaded during hybris startup
Is constructed using all configuration files of all the extensions by start-up time and is loaded during hybris startup
Which of the following listeners will allow beans defined within Web Application Context to refer the beans available in Global Application context?
- org.springframework.wecontext.ContextLoaderListener
- org.springframework.wecontext.request.RequestContextListener
- de.hybris.platform.spring.HybrisContextLoaderListener
- none of the above
de.hybris.platform.spring.HybrisContextLoaderListener
Which of the following is not a valid type of Advice?
- Around advice
- After advice
- After throwing advice
- Before throwing advice
Before throwing advice
Which of the following are common and important Application Context implementations?
- ClassPathXmlApplicationContext
- FileSystemXmlApplicationContext
- XmlWebApplicationContext
- HybrisApplicationContext
ClassPathXmlApplicationContext
FileSystemXmlApplicationContext
XmlWebApplicationContext
Which of the following are two important bean lifecycle methods?
- setup and teardown
- init and destroy
- create and destroy
- setup and destroy
setup and teardown
Which of the following bean scopes are valid only in the context of a web-aware Spring ApplicationContext?
- tenant
- prototype
- yrequest
- request
request
Which of the following variable resolver lets you use Spring with JSF?
- org.springframework.wejsf.DelegatingVariableResolver
- org.springframework.weDelegatingVariableResolver
- Spring cannot be used with JSF
- none of the above
org.springframework.wejsf.DelegatingVariableResolver
Which of the following Spring Security concepts are relevant to Hybris?
- Authentication Provider
- Access Decision Voter
- Password Callback
- All of the above
All of the above
Choose which is true:
- Central to the Spring Framework is its IOC container
- IOC provides a consistent means of configuring and managing Java objects using call-backs.
- IOC container is responsible for managing object lifecycles
- The object life cycle used for creates objects, call initialization methods, and configure objects by wiring them together.
- All of above
- None
All of above
What is the Type of Proxy in Spring Framework?
- Static
- Dynamic
- Response
- None
Dynamic
How could you externalize constants from a Spring configuration file or a Spring annotation into a .properties file ? Select one or more answers
- By using the <constant></constant> tag
- By declaring the ConstantPlaceholderConfigurer bean post processor
- By using the <property-placeholder></property-placeholder> tag
- By using the c: namespace
By using the <property-placeholder></property-placeholder> tag
What statements are not correct? Select a unique answer.
- Constuctor and properties autowiring in the same bean are not compatible
- A bean should have a default or a no-args constructor
- The <constructor-arg> tag could take type, name and index to reduce ambiguity</constructor-arg>
- None of the above
- All of the above
All of the above
What could not return a Spring MVC controller? Select a single answer.
- An absolute path to the view
- A logical view name
- A new JstlView
- void
An absolute path to the view
Where do you cannot declare Spring MVC controller? Select one or more answers.
- In a Spring application context XML configuration file
- Into the wexml file of the web application
- Into the java code by using annotations
- Into the JSP pages
- Into the wexml file of the web application
- Into the JSP pages
How could you secure MVC controller with Spring Security? Select a unique answer.
- With the @Secured annotation
- With the @RolesAllowed annotation
- In a XML security configuration file
- All of the above
- None of the above
All of the above
What are the possible mechanisms provided by Spring Security to store user details? Select one or more correct answers.
- Database
- JAAS
- LDAP
- Properties file
- Database
- JAAS
- LDAP
- Properties file
What is true about Spring security configuration and the security namespace? Select one or more correct answers
- The access attribute of the intercept-url tag support both EL and constants together.
- The patterns declared into the intercept-url tag are analyzed from up to bottom. Winning is the first that matches
- The patterns declared into the intercept-url tag use by default the java regex syntax.
- Security rules may applied depending request parameter
The patterns declared into the intercept-url tag are analyzed from up to bottom. Winning is the first that matches
Spring MVC is a request-based framework.
- Yes
- No
Yes
Spring’s Transaction management feature can fully replace all the features of EJB’s Container managed transaction
- Yes except the global transactions
- FALSE
- True , no exceptions
Yes except the global transactions
What do you understand by Inversion of Control(IO
- The object define their dependencies and the container injects the dependencies when it creates the bean
- A property available in the Spring Framework in which caller methods control the creation of parent
- Inversion of Control (Io is an object-oriented programming practice where the object coupling is bound at run time by an assembler object and is typically not known at compile time using static analysis
- The object define their dependencies and the container injects the dependencies when it creates the bean
- Inversion of Control (Io is an object-oriented programming practice where the object coupling is bound at run time by an assembler object and is typically not known at compile time using static analysis
What are the types of injection supported by Spring ?
Constructor Injection only
Constructor Injection and Setter Injection
Constructor Injection , Setter Injection and Interface Injection
Constructor Injection and Setter Injection
Can you instantiate a static inner class in spring
No. Static classes are not supported
Yes. They are instantiated by default with the class
Yes. But you will have to use the binary name of the class
Yes. But you will have to use the binary name of the class
Which of the following features are available when using the spring templating class such as JdbcTemplate
- Automatic Transaction Management
- Exception Handling
- Load Balancing
- Cache Management
- Resource look up
- Automatic Transaction Management
- Exception Handling
- Resource look up
The basic principle behind Dependency Injection(DI) is that the objects define their dependencies . What are the different ways in which an object can define its dependency
- Through Constructor arguments
- Arguments to a factory method
- Properties which are set on the object instance after it has been constructed or returned from a factory method
- xml file
- Through Constructor arguments
- Arguments to a factory method
- Properties which are set on the object instance after it has been constructed or returned from a factory method
What are important ApplicationContext implementations in spring framework
XmlWebApplicationContext
FileSystemXmlApplicationContext
ClassPathXmlApplicationContext
URLPathXmlApplicationContext
What is technically a ‘bean’ in Spring
It is a special component of the IOC container
It is the regular java bean with some special features and capabilities in spring
A bean is simply an object that is instantiated, assembled and otherwise managed by a Spring IoC container; other than that, there is nothing special about a bean
I want to add the MessageSource functionality to application, providing access to messages in i18n-style. Which one should I use
ApplicationContext
Properties file
ServletContext
An application server is required for Spring’s Transaction mechanism to run. This statement is True/false
TRUE
FALSE
What is true about Spring security configuration and the security namespace? Select one or more correct answers
The access attribute of the intercept-url tag support both EL and constants together. null
The patterns declared into the intercept-url tag are analyzed from up to bottom. Winning is the first that matches. null
The patterns declared into the intercept-url tag use by default the java regex syntax.
Security rules may applied depending request parameter. Explanation– Security rules may apply to request URL, request method (GET, POST ) but not to request parameters.
What is the easiest method to write a unit test
void displayAccount(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
void displayAccount(HttpServletRequest req, HttpSession Session) throws ServletException, IOException
@RequestMapping(“/displayAccount”)String displayAccount(@RequestParam(“accountId”) int id, Model model).
@RequestMapping(“/displayAccount”)String displayAccount(@PathVariable(“accountId”) int id, Model model).
Which of the following are true
Registry.getApplicationContext() always returns the GlobalApplicationContext
Dispatcher servlet is configured in the web.xml file.
Yrequest scope is similar to the standard spring request scope and is used within the web application context.
Tenant scope makes sure that one instance of bean is shared by all the tenants
The configuration of a web ApplicationContext is done in
Extension-spring.xml
Extension-web-spring.xml
Web.xml
Project.properties file
The WebApplicationContext is created from configuration files specified ————– parameter
contextConfigLocation
webContextLocation
contextLoaderListener
servletConfigLocation
Which of the following are true
Spring supports injection through getters and setters
Spring supports constructor injection
Spring supports interface injection
Spring doesn’t support constructor injection
If we need to specify a configuration file for dispatcher Servlet, which of the following needs to be done
<init-param> tag inside the <servlet> tag.</servlet></init-param>
< servlet> tag inside the < init-param> tag.
Any of these
None of these
<requires-extension> entry is made in ……………………..</requires-extension>
Project.properties
extensioninfo.xml
Wexml
{Extension_name}.spring.xml