Home » Tag Archives: Spring (page 40)

Tag Archives: Spring

Spring – Adding AOP support

aspectj-logo

I heard a story about one senior (and quite highly paid) softwaree engineer. He was given task to log every method in every controller in project he was working on. Engineer rewrote all controller methods, so from code like this: @RequestMapping(method = RequestMethod.GET) public String showEmployees(Model model) { List<Employee> employees = employeeDao.list(); model.addAttribute('employees', employees); return 'employees/list'; } he made following ...

Read More »

Spring – Adding Spring MVC – part 2

spring-interview-questions-answers

In the previous part we’ve implemented controllers for managers and employees. Now that we know our way around, we’ll do little (but just little) more complicated stuff – controllers for tasks & timesheets. So let’s start with org.timesheet.web.TaskController. First create a class and this time we will be accessing richer domain, so we’ll need to autowire three DAOS – for ...

Read More »

Spring – Adding Spring MVC – part 1

spring-interview-questions-answers

Welcome to the fourth part of this tutorial. In this part, we will write controllers and views using Spring MVC and think about our REST model. First thing that we must do, is make a web application from what we have so far. We will add web/WEB-INF folder to our project root. Inside WEB-INF create jsp folder. We will put ...

Read More »

Spring – DAO and Service layer

spring-interview-questions-answers

Welcome to the third part of Spring tutorial. In this part, we will continue in writing our Timesheet application and this time we’ll implement DAO layer, business services and write some tests. In the previous part, we’ve defined GenericDao interface that tells us, what operations we will need to perform upon entities. Now we need to provide implementation. We will ...

Read More »

Spring – Persistence layer – writing entities and configuring Hibernate

spring-interview-questions-answers

Welcome to the second part of this tutorial. Don’t freak out when you see how long this article is – I promise you it’s mostly easy POJOs and some generated code. Before we start, we need to update our Maven dependencies, because we will be using Hibernate and Spring now. Add following dependencies to your pom.xml: <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>3.6.8.Final</version> ...

Read More »

Spring – Designing the domain model and the service layer

spring-interview-questions-answers

We are going to build application for timesheet management. So let’s think about some uses cases and entities first. Let me write them in the few bullets: Task is assigned to employee by manager. One task can be assigned to many employees. Employee fills the amount of hours that he worked on certain task to the system. Manager/Employee views reports ...

Read More »

Spring 3.1 Caching and @CacheEvict

spring-interview-questions-answers

My last blog demonstrated the application of Spring 3.1’s @Cacheable annotation that’s used to mark methods whose return values will be stored in a cache. However, @Cacheable is only one of a pair of annotations that the Guys at Spring have devised for caching, the other being @CacheEvict. Like @Cacheable, @CacheEvict has value, key and condition attributes. These work in exactly the same way as those supported by @Cacheable, so for more information on ...

Read More »

Spring 3.1 Caching and @Cacheable

spring-interview-questions-answers

Caches have been around in the software world for long time. They’re one of those really useful things that once you start using them you wonder how on earth you got along without them so, it seems a little strange that the Guys at Spring only got around to adding a caching implementation to Spring core in version 3.1. I’m ...

Read More »

Wire object dependencies outside a Spring Container

spring-interview-questions-answers

There are a few interesting ways of setting the properties and dependencies of an object instantiated outside of a Spring container. Use CasesTo start with, why would we need to do inject in dependencies outside of a Spring container – I am aware of three use cases where I have instantiated objects outside of the Spring container and needed to ...

Read More »

Spring Profiles and Java Configuration

spring-interview-questions-answers

My last blog introduced Spring 3.1’s profiles and explained both the business case for using them and demonstrated their use with Spring XML configuration files. It seems, however, that a good number of developers prefer using Spring’s Java based application configuration and so Spring have designed a way of using profiles with their existing @Configuration annotation. I’m going to demonstrate ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close