Monday, 3 March 2014
Less unit test code doesn't necessarily result into poor coverage. I've recently entered the paradigm of parameterized tests when refactoring a larger test suite. I ended up writing significantly less code without compromising on the extent. In fact, adding a few corner cases was almost a no-brainer. In this post I'd like to share my experience with JUnitParams and discuss advantages of parameterized unit tests.
Sunday, 9 February 2014
In this post, I will look into the distinction between a component and a bean. Even though both of them refer to Spring managed beans, each serves a different purpose. @Component and its specializations (@Controller, @Service and @Repository) allow for auto-detection using classpath scanning. @Bean on the other hand can only be used to explicitly declare a single bean in a configuration class.
Sunday, 26 January 2014
Last time, when I talked about lazily loaded beans I forgot to mention one interesting feature of Spring 4 - lazily loaded injection points. This post introduces the combination of @Lazy and @Autowire as a counterpart to the standard approach (JSR-330) using @Inject and Provider.
Saturday, 25 January 2014
Lazy initialization allows for a greater flexibility and performance by delaying bean instantiation to the very last moment. A fairly straightforward feature represented by a simple annotation @Lazy. Yet, as usual, there are a few pitfalls to watch out for.
Sunday, 12 January 2014
Last time I talked about @Primary and @Autowire as a useful means of dependency injection. Today I will brief you on how @Autowire compares to its more standard counterpart @Resource and demonstrate @Qualifier as a handy complement to @Autowire.
Monday, 6 January 2014
With a recent upgrade of my favorite framework I was thinking a short recap wouldn't harm. This very first post, from a series of articles on Spring's features I find interesting, deals with intricacies of injecting the right bean out of a range of suitable candidates. If you are keen to learn about the trade-offs when using @Primary keep reading.