Submitted by heartin on Fri, 09/09/2016 - 06:04
Here I will list out upcoming notes or notes sections (books) on Spring.
-
Aspect Oriented Programming
-
Testing with Spring
-
Transactions with Spring
-
Spring and Data
-
Spring Boot Essentials (In progress)
-
Spring MVC Essentials (In progress)
Note:
Submitted by heartin on Fri, 09/09/2016 - 05:56
There are different ways to executing some code during initialization and destruction of a bean. We could do that using InitializingBean interface, but there are better approaches using annotations.
We will see two of such approaches here:
-
Using initMethod and destroyMethod attributes of the @Bean annotation
Submitted by heartin on Fri, 09/09/2016 - 04:37
Beans in Spring can be either singletons or prototypes. Singleton means that only one instance of the bean will be maintained by the Spring and will be returned every time you call the getBean() method. If you set the scope to prototype, then a new bean will be created every time you call the getBean() method.
The default is singleton. In Java configuration, you can specify that a bean scope is prototype by specifying @Scope("prototype") over the bean definition.
Submitted by heartin on Fri, 09/09/2016 - 01:13
These are additional exercises you can try out once after learning and practicing all the previous exercises in this section. There will be also hints to make things easier.
-
Provide examples for autowire for type and autowire by constructor.
-
Rewrite the following programming using annotations and java configuration: http://javajee.com/autowiring-in-spring-through-xml-configuration-example.
Submitted by heartin on Tue, 09/06/2016 - 20:15
Traditionally Spring applications were configured using only xml configurations. Later annotations such as @Component came and complemented the xml configuration. However later XML configurations were completely replaced by Java configurations that use annotations such as @Bean.
Xml configuration
In xml configuration, you use xml to configure beans.
We can load an xml configuration file from a standalone application as:
Pages