Save
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

Spring Core

QuestionAnswer
Can I configure Spring using a Java class instead of XML? Yes. You can annotate a class with @Configuration to indicate to the Spring IoC contaner that the class can be used as a source of bean definitions.
What is Bean Factory? 1 of 4 A BeanFactory is like a factory class that contains a collection of beans. The BeanFactory holds Bean Definitions of multiple beans within itself and then instantiates the bean whenever asked for by clients.
What is Bean Factory? 2 of 4 We create a bean factory or application context during the execution of our application, usually in our main method.
What is Bean Factory? 3 of 4 BeanFactory is able to create associations between collaborating objects as they are instantiated. This removes the burden of needing to tightly couple your objects.
What is Bean Factory? 4 of 4 BeanFactory also takes part in the life cycle of a spring bean, making calls to custom initialization and destruction methods.
Can a bean be defined within a bean? Yes, this is called an inner bean, and it is a bean that is defined within the scope of another bean.
What are the common implementations of the Application Context ? 1 of 5 ClassPathXmlApplicationContext : It loads context definition from an XML file located in the classpath, treating context definitions as classpath resources. The application context is loaded from the application’s classpath by using the code .
What are the common implementations of the Application Context ? 3 of 5 FileSystemXmlApplicationContext : It loads a context definition from an XML file in the file system. The application context is loaded from the file system by using the code .
What are the common implementations of the Application Context ? 5 of 5 ● XmlWebApplicationContext : It loads context definition from an XML file contained within a web application.
What are the common implementations of the Application Context ? 2 of 5 ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");
What are the common implementations of the Application Context ? 4 of 5 ApplicationContext context = new FileSystemXmlApplicationContext("bean.xml");
What is the difference between BeanFactory and ApplicationContext ? 1 of 5 On the surface, an ApplicationContext is the same as a the bean factory, but it offers much more.. ●     ApplicationContext preinstantiates the beans (Singletons) while BeanFactory does lazy initialization.
What is the difference between BeanFactory and ApplicationContext ? 2 of 5 ApplicationContext provides a means for resolving text messages including support for I18N. ApplicationContext provide a generic way to load file resources such as images. ApplicationContext can publish events to beans that are registered as listeners.
What is the difference between BeanFactory and ApplicationContext ? 3 of 5 Certain operations on the container or beans in the container, which have to be handled in a programmatic fashion with a bean factory, can be handled declaratively in an application context.
What is the difference between BeanFactory and ApplicationContext ? 4 of 5 ResourceLoader support: Spring’s Resource interface us a flexible generic abstraction for handling low-level resources. An ApplicationContext itself is a ResourceLoader, Hence provides an application with access to deployment-specific Resource instances.
What is the difference between BeanFactory and ApplicationContext ? 5 of 5 MessageSource support: The ApplicationContext implements MessageSource, an interface used to obtain localized messages, with the actual implementation being pluggable.
What is Application Context? An ApplicationContext is a more advanced containerbean factory. Both load bean definitions, wire beans together, and dispense beans upon request.
What are the benefits of IOC ? 1 of 7 Minimizes the amount of code in your application with IOC containers. You can also easily add additional services by adding a new constructor or a setter method with little or no extra configuration.
What are the benefits of IOC ? 2 of 7 Loose coupling is promoted with minimal effort and least intrusive mechanism.
What are the benefits of IOC ? 3 of 7 The factory design pattern is more intrusive because components or services need to be requested explicitly whereas in IOC the dependency is injected into requesting piece of code.
What are the benefits of IOC ? 4 of 7 Also some containers promote the design to interfaces not to implementations design concept by encouraging managed objects to implement a well-defined service interface of your own.
What are the benefits of IOC ? 5 of 7 Make your application more testable by not requiring any singletons or JNDI lookup mechanisms in your unit test cases.
What are the benefits of IOC ? 6 of 7 IOC containers make unit testing and switching implementations very easy by manually allowing you to inject your own objects into the object under test.
What are the benefits of IOC ? 7 of 7 ● IOC containers support eager instantiation and lazy loading of services. Containers also provide support for instantiation of managed objects, cyclical dependencies, life cycles management, and dependency resolution between managed objects etc
What is @Qualifier? @Qualifier can be used along with @Autowired to remove confusion, by specifying exactly what bean needs to be wired.
What are stereotypes? A stereotype is an annotation that marks a class for Bean management by Spring. Stereotypes are recognized by Spring when it automatically scans the project for beans to manage.
What is the generic stereotype and what stereotypes derive from it? The generic stereotype is @Component. The stereotypes that derive from @Component include @Repository, @Service, and @Controller.
What are two things that the Main program must do in order to properly run as a Spring Application? 1 of 2 1. Create an application context by creating a variable context of type ApplicationContext and set it equal to a new object of type
What are two things that the Main program must do in order to properly run as a Spring Application? 2 of 2 2. ClassPathXmlApplicationContext("Beans.xml") Get the required bean by calling the getBean method from your ApplicationContext object and pass in the name of the bean.
What is @Bean? @Bean is a method-level annotation. When spring encounters @Bean above a method, that method's returned object will be registered as a bean in Spring's container. "@Bean(name='myBeanName') public MyClass methodOne() { return new MyClass(); }"
What is @Inject? @Inject does the same thing as @Autowired @Inject is java's implementation, @Autowired is Spring's implementation
How does the @Autowired annotation work? 1 of 2 It is used to automatically wire dependencies into properties, methods, or constructors. The autowiring works similar to xml-based autowiring.
How does the @Autowired annotation work? 2 of 2 @Autowired is place above the a property, above a constructor, or above a setter. If no bean is found to wire to the annotated property then a NoSuchBeanDefinitionException is thrown by default
How do you turn ON annotation-based autowiring in Spring? To turn ON autowiring use the <context:annotation-config/> tag in the spring xml. This will enble @Autowired, @Inject (JSR-330), and @Resource (JSR-250).
What annotations are used to register a class as a spring bean? 1 of 2 By default, <context:component-scan> in the beans.xml tells the container to look for classes that are annotated with one of the following: @Component The class defines a Spring component.
What annotations are used to register a class as a spring bean? 2 of 2 @Controller The class defines a Spring MVC controller. @Repository The class defines a data repository such as a DAO implementation class. @Service The class defines a service. There are more, like @RestController and @Configuration
What are Spring annotations? 1 of 2 Spring Annotations allow you to configure the dependency injection by moving bean configuration into the component class itself by using annotations on the relevant class, method, or field declaration.
What are Spring annotations? 2 of 2 Annotations can replace the need to use XML to describe a bean wiring.
What are the different autowiring modes that you can specify? 1 of 5 No - The default setting; means no autowiring and you should use explicity bean reference for wiring.
What are the different autowiring modes that you can specify? 2 of 5 byName - Tries to match and wire a property if its type matches with exactly one of the beans name in the configuration file. (In summary, it looks at variable names)
What are the different autowiring modes that you can specify? 3 of 5 byType - Tries to match and wire a property if its type matches with exactly one of the beans name in the configuration file. (In short, it looks at the datatypes)
What are the different autowiring modes that you can specify? 4 of 5 constructor - Tries to match and wire a property if its constructor argument type matches one of the beans name in the configuration file.
What are the different autowiring modes that you can specify? 5 of 5 autodetect - Spring will first try to wire by constructor, then byType. (deprecated so it won't show up in the intellisense)
What is autowiring? 1 of 2 Autowiring refers to the process of the Spring container automatically defining relationships between collaborating beans.
What is autowiring? 2 of 2 The autowiring functionality has four modes: byName, byType, constructor, and autodetect. We tell Spring to autowire beans in the beans.xml OR using annotations.
What do you mean by bean wiring ? The act of creating associations between application components (beans) within the Spring container is referred to as Bean wiring. We wire beans in the beans.xml OR using annotations.
What are the different types of dependency injection and which does Spring support? 1a of 3 There are four types of dependency injection: ●     Constructor Injection: Dependencies are provided as object through constructor parameters.
What are the different types of dependency injection and which does Spring support? 4a of 3 ● Field Injection: Dependencies are provided as objects DIRECTLY into the variables themselves through reflection.
What are the different types of dependency injection and which does Spring support? 3 of 3 ● Interface Injection: Dependencies are provided as objects through setter methods that were SPECIFICALLY declared in an interface; so that any child class may have its dependency injected.
What are the different types of dependency injection and which does Spring support? 1b of 3 Constructor-Based DI - The container invokes a class constructor with a number of arguments, each representing a dependency. Should be used for MANDATORY dependencies, so you make sure that the object has the dependency at ALL times.
What are the different types of dependency injection and which does Spring support? 2a of 3 Setter-Based DI - The container calls the setter methods on your beans after invoking the no-args constructor. Could/Should be used with optional dependencies.
What are the different types of dependency injection and which does Spring support? 2b of 3 ● Setter Injection: Dependencies are provided as objects through setter methods.
What are the different types of dependency injection and which does Spring support? 4b of 3 Officially, Spring supports "only" Constructor and Setter Injection. But field injection DOES exist in Spring. "Field-Based DI - Reflection is used to supply each field with its dependency. HOWEVER, this method should be avoided.
What are the different types of dependency injection and which does Spring support? 4c of 3 Downsides of field DI: ● Your fields should be hidden from the outside world ● It tightly couples your client class with the DI container
What are the different types of dependency injection and which does Spring support? 4d of 3 ● You can't make immutable fields anymore ● Your classes can no longer be created without reflection Keep in mind that field injection is done by putting the @Autowired directly above a field. So you should be avoiding this."
What is dependency injection? 1 of 3 Dependency injection is a specific implementation of inversion of control (IOC). First, what is a dependency? A dependency is a service class that can be utilized by another class(es); these other classes can be referred to as client classes.
What is dependency injection? 2 of 3 Dependency Injection (DI) is a subset of Inversion of Control (IOC). Specifically, DI gives up the process of managing dependencies to another entity. In Spring, we give up the ability to create and manage our objects, we let Spring manage them.
What is dependency injection? 3 of 3 Spring will inject dependencies through a constructor or setter. All we have to do is tell Spring what it should be managing (through an XML file or annotations)
What is IOC? 1 of 2 IoC stands for inversion of control. IoC is when an entity relinquishes control of a process/functionality to another separate entity. IOC is used heavily in all frameworks such as Spring, Struts, and EjB.
What is IOC? 2 of 2 Simply put, IoC refers to transferring control of objects or portions of a program to a container or framework.
What is the life cycle of a Spring bean? 1 of 5 (I) - Instantiation - Creates the bean instance (P) - Populate Properties - Dependency is injected (N) - Set Name - Sets the name of the bean in the bean factory that created it (F) - Set Factory - Supplies the owning factory to a bean instance
What is the life cycle of a Spring bean? 2 of 5 (C) - Set Application Context - Sets the ApplicationContext that this object runs in (B) - Before Post Processing - Apply this BeanPostProcessor to the given new bean instance before any bean initialization
What is the life cycle of a Spring bean? 3 of 5 (A) - After Populate Properties - Invoked by a Bean Factory after it has set all bean properties supplied (I) - Custom Init - Invoked
What is the life cycle of a Spring bean? 4 of 5 (A) - After Post Processing - Apply this BeanPostProcessor to the given new bean instance after any bean initialization (U) - Use - Use the bean
What is the life cycle of a Spring bean? 5 of 5 (D) - Destroy - Invoked by a BeanFactory on destruction of a singleton (D) - Custom Destroy - Executed if there is any defined destroy-method attributes
What is the default scope of a Spring bean if a scope is not defined? Singleton.
What are the five scopes that a Spring Bean? 1 of 3 Singleton - Scope is defined to a single instance per Spring IoC container. Prototype - Scope is defined to have any number of object instances.
What are the five scopes that a Spring Bean? 2 of 3 Request - Scope is defined to an HTTP request (only in a web aware ApplicationContext) Session - Scope is defined to an HTTP session (only in a web aware ApplicationContext)
What are the five scopes that a Spring Bean? 3 of 3 Global-Session - Scopes a bean to a global HTTP session (only in a web aware ApplicationContext)
What is a Spring Bean? 1 of 2 A bean, in Spring, is an object that is instantiated, assembled and otherwise managed by a Spring IoC container. They have been created with the configuration metadata that you supply to the container
What is a Spring Bean? 2 of 2 In short, it's a class that you've asked Spring to manage for you.
What are the two distinct types of containers that Spring provides? BeanFactory - The simplest container providing basic support for DI. BeanFactory is no longer the preferred container to use. ApplicationContext - Extends BeanFactory and adds more enterprise-specific functionality such as text messaging.
What is the root tag of the Beans.xml file? How would you go about adding a bean? The root tag is <beans>. Within the beans tag, we define each bean using a new <bean> tag. We can specify the id and class name used to create the bean.
What is the Bean Configuration File, and what is the file typically named? The Bean Configuration File is an XML file created with the configuration metadata that you supply to the container. It contains the definitions of the beans and how beans are associated with one another. It is typically named Beans.xml.
Name the modules of Spring. Spring Core, Web-MVC, ORM, AOP, Test, Security
What are some features of Spring ? 1 of 7 ●     Lightweight: spring is lightweight when it comes to size and transparency. The basic version of spring framework is around 1MB. And the processing overhead is also very negligible.
What are some features of Spring ? 2 of 7 ● Inversion of control (IOC): Loose coupling is achieved in spring using the technique Inversion of Control. The objects give their dependencies instead of creating or looking for dependent objects.
What are some features of Spring ? 3 of 7 ● Aspect oriented (AOP): Spring supports Aspect oriented programming and enables cohesive development by separating application business logic from system services.
What are some features of Spring ? 4 of 7 ● Container: Spring contains and manages the life cycle and configuration of application objects.
What are some features of Spring ? 5a of 7 ● MVC Framework: Spring comes with MVC web application framework, built on core Spring functionality.
What are some features of Spring ? 5b of 7 This framework is highly configurable via strategy interfaces, and accommodates multiple view technologies like JSP, Velocity, Tiles, iText, and POI. But other frameworks can be easily used instead of Spring MVC Framework.
What are some features of Spring ? 6a of 7 ● Transaction Management: Spring framework provides a generic abstraction layer for transaction management. This allowing the developer to add the pluggable transaction managers,
What are some features of Spring ? 6b of 7 and making it easy to demarcate transactions without dealing with low-level issues. Spring’s transaction support is not tied to J2EE environments and it can be also used in container less environments.
What are some features of Spring ? 7a of 7 ● JDBC Exception Handling: The JDBC abstraction layer of the Spring offers a meaningful exception hierarchy, which simplifies the error handling strategy.
What are some features of Spring ? 7b of 7 Integration with Hibernate, JDO, and iBATIS: Spring provides best Integration services with Hibernate, JDO and iBATIS
What is Spring ? 1 of 3 Spring is an open source, module based framework created to address the complexity of enterprise application development. It provides comprehensive infrastructure support for deploying robust enterprise-level applications easily and rapidly.
What is Spring ? 2 of 3 One of the chief advantages of the Spring framework is its layered architecture, which allows you to be selective about which of its components you use while also providing a cohesive framework for J2EE application development.
What is Spring ? 3 of 3 You can pick and choose the packages and classes that you need and ignore the ones you don't.
Created by: wahoo99
Popular Computers sets

 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards