Monday, October 31, 2011

Tuesday, October 18, 2011

Spring Roo presentation

Last week I gave a presentation on Spring Roo in Silicon India conference held in Hyderabad. I tried my best to give a complete example that makes use of Spring Roo features to develop a Flight Booking application. Link to PDF: http://www.siliconindia.com/events/siliconindia_events/Java_Hyd_Conf/Ashish_Spring_Roo.pdf

Wednesday, October 5, 2011

Quick introduction to AspectJ ITD

In this post, I'll show a few examples of AspectJ ITDs that are generated by Spring Roo and the declarations contained in those ITDs. You'll find a more detailed discussion in Chapter 1 (which is available for download) of Spring Roo 1.1 Cookbook.

Example 1: FlightService_Roo_ToString.aj
package sample.roo.flightapp.service;

privileged aspect FlightService_Roo_ToString {
   
    public String FlightService.toString() {
        StringBuilder sb = new StringBuilder();
       sb.append("Origin: ")
         .append(getOrigin());
        return sb.toString();
    }
} 

The following figure shows what the above declaration implies:


Example 2FlightService_Roo_Serializable.aj

package sample.roo.flightapp.service;

import java.io.Serializable;

privileged aspect FlightService_Roo_Serializable {
   
  declare parents: FlightService implements Serializable;
   
  private static final long FlightService.serialVersionUID
      = 5059552858884348572L
}


The following figure shows what the above declaration implies:


Tuesday, October 4, 2011

Spring Roo 1.1 Cookbook promotion at Javaranch

This week I'll be responding to questions related to Spring Roo in the Spring forum of Javaranch (http://www.coderanch.com/forums/f-96/Spring). You can win a copy of the book by posting questions in the Spring forum.

Spring Roo - future of Java application development

Traditional Java enterprise application development required developers to write the boilerplate code. The Spring Framework simplified Java enterprise application development with DI and POJO-based approach to developing applications. No wonder, Spring Framework has become the most popular platform for developing applications.

Spring Framework simplifies developing enterprise applications using standard technologies, like JPA, Hibernate, JDBC, Flex, JavaMail, JMS, and so on. Still, you need to write some generic configuration and generic code which can be generated by a tool. Let's look at a few examples:

1. If you write a class, you normally override the toString method
2. If you write a JPA entity class, then you provide getter/setters methods for persistent fields, method to obtain reference to EntityManager, create persistence.xml, and so on.
3. When using Spring Web MVC, you need to configure handler mappings, create controller classes corresponding to JPA entities, create JSP views, and so on.
...

And the list goes on and on, depending upon the technology or framework that you are using. If all these generic configurations and code are generated and managed by a development tool, developers will be more productive. And, if the code generated follows best practices of development, then you don't need to even worry about incorporating best practices in your application architecture. This is where Spring Roo comes as the next generation productivity improvement tool.

Spring Roo generates generic configurations and code to help developers focus on writing the business logic. There are no runtime dependencies of application on Spring Roo, and you can easily modify the Roo-generated code by using Push-in refactoring. So, even though you are using a productivity improvement tool, you have full control over modifying the generated code, and you don't need to learn any new language or frameworks to do so. If you know Spring, you can easily get started with using Spring Roo effectively. Spring Roo truely defines the future of enterprise Java application development.