Evolution of Open-Source Enterprise Service Bus (ESB)
Evolution of open-source Enterprise Service Bus (ESB):
Developers involved in complex system integration will know how intriguing system integration can get to. Integration of disparate enterprise applications is always challenging because of the need to get them work together. It also has become an increasingly essential element of IT, where we oftenly come across terms such as BI (Business Integration), B2B (Business to Business) etc. A decade earlier, technology choices were limited. Integration of enterprise applications had to chose either an application server or a heavyweight enterprise application integration (EAI) solution that required a huge upfront investment in infrastructure, money, and human resources. There was a need for a lightweight solution which is easy to deploy and manage. Many enterprises at that time, built thier own abstractions on top of thier messaging servers. By doing so, it was an extreme undertaking and a huge burden on the developers.
Since IBM first released MQSeries, enterprises have been sold on the benefits of decoupling systems using point-to-point message queues. When TIBCO brought Rendezvous to the market, it expanded the horizons of messaging by introducing the publish-subscribe model. The Java Message Service (JMS)—born through Sun’s Java Community Process (JCP)—set out to unify the point-to-point and publish-subscribe messaging models. It wasn’t long before enterprises required more than just messaging, they also needed a way to orchestrate messages between systems and perform transformations.
To address this need, major vendors such as IBM, Oracle, and Microsoft built EAI brokers that added message brokering and centralized transformation engines on top of their existing messaging servers. The problem with the EAI approach was that it adopted a hub-and-spoke architecture where all data had to flow through the EAI broker. Although this worked for many applications, enterprises were soon pushing the boundaries of these systems and it became clear that something more flexible, scalable, and distributed was required. Enterprises needed connectivity, transaction management, security, and message routing, and they needed to host services that operated on data moving around their systems.
Working on integration projects used to mean working with enterprise application integration (EAI) products, each of which implemented its own stack of tools with proprietary technology. To switch from one EAI product to another meant learning the proprietary technology and toolset from that new product. With more focus on open standards that emerged in the integration market, the market changed from EAI to service oriented architecture (SOA) and enterprise service bus (ESB) products. Examples of these open standards are Java Message Service (JMS), SOAP, XML, and WS*. With open standards available, more and more open source projects began to implement these specifications. There was a need for an open source solution built on open standards.
The next step of this evolution led to what is now known as an ESB: Data and exchanges are conveyed from system to system in a single logical bus, decoupling all the systems from each other. This leads to a much more maintainable system and can save a lot of time in the long term. Integration technologies are becoming commodity software, and the rise of open source integration frameworks is hence becoming increasingly important. Open source is now unavoidable, from JMS brokers to SOAP stacks to ESBs. Companies generally use ESBs to convey sensitive data, and they sometimes need advice when they’re developing the applications hosted in the ESBs or when they’re putting these applications in production. The industry needed the ESB.
Subversion, Apache Server, Subclipse installation & configuration
Ever wanted to have a code repository of your own? Either working on a small project or working with your friends on the next big thing, it would be great to have a repository where you can maintain your code, just as you would while working at your office. Lot of you might have been using version controls at workplaces such as CVS, VSS etc. Many will have an urge to maintain their homework using a version control mechanism. But is it all that easy? Well, it isn’t a one-go shot for a starter. Here is this post throwing light on how precisely to do that.
For beginners, probably the only thing relatable is the name of the version control alone, but how to get it, how to install it, how to configure it and then how to use it, will all be things to follow. There are many open-source free version controls available, do explore their features and chose the one best for you. This post though specifically guides your way through installing and configuring Subversion. Before reading the rest of the post, it would be helpful to get into a primer about subversion / subversion client / using subversion locally/ using subversion remotely etc. For a comprehensive look into subversion, read it here. Subversion is a small and simple enough version control to run on a development machine to give a full-fledged source code control. You can get down and dirty by manually installing and configuring subversion like many others who have shed enough time doing it manually starting with downloading subversion here.
Manual Download/Installation/Configuration of subversion:
Here are the list of few links that should help get started with manually installing and configuring subversion:
Disable EditPlus backup .bak files
I have been using Editplus as a high-end alternative to notepad, and ofcourse it is meant for much more. When you install a fresh copy of Editplus, you will find (.bak) files saved along with the actual file that you may edit. It is supposed to be helpful, and well may be, but at most times its a pesky task to remove them, as chances of using them are highly unlikely.
EditPlus is a text editor, HTML editor, PHP editor and Java editor for Windows. While it can serve as a good Notepad replacement, it also offers many powerful features for Web page authors and programmers.
To disable creation of the backup files (*.bak) while editing in EditPlus, follow this step:
-
Go to Tools -> Preferences -> ‘Files’ category and turn off ‘Create backup file when saving’ option. You can also opt to save all the back up files in a chosen destination if you wish to, by clicking on ‘backup options’.

Eclipse IDE Workbench, Editing, Ant, Help Tips & Tricks
Eclipse IDE Workbench, Editing, Ant, Help Tips & Tricks:
In continuation to the previous post, this one has Tips & Tricks for Views in Eclipse IDE. Refer to posts in Eclipse Tips & Tricks for others.
Note: If the image displayed below is unclear, then click on the image. Then hover over the image in the newly opened window. You will get a zoom icon, click the image with it and it will be displayed with better visibility. Read more…
SpringSource Tool Suite Installation & Configuration
SpringSource Tool Suite(STS) Installation & Configuration:
At the time of this post, the latest version available form SpringSource is STS 2.2.1. Since its built on top of Eclipse (version 3.5 – Galileo), you will need to have Java installed on your computer. Refer to Eclipse IDE category posts for details on this part. It requires JDK 5 and higher and is supported on Windows, Mac & Linux operating systems so far. I will be posting ‘Exploring Spring Framework’ series developed using STS, so this is a starter post for it. Moreover, its worth trying such a comprehensive Spring development tool which has been made available for free recently.
As such downloading and installing STS is straight forward. All you have to do is to visit the SpringSource STS site and follow the instructions. Yet, here is step-by-step instructions and other relative information for doing it.
Follow the steps below to download & install STS:
-
Before downloading STS, make sure that your system meets these pre-requisites. As you can see, you need to have JDK 5 or higher installed in your system. [Refer to Java Installation & Configuration post for details].

Eclipse IDE Miscellaneous & Debugging Tips & Tricks
Eclipse IDE Productivity Tips & Tricks – Miscellaneous & Debugging:
In continuation to the previous post, this one has Tips & Tricks for Views in Eclipse IDE. Refer to posts in Eclipse Tips & Tricks for others.
Note: If the image displayed below is unclear, then click on the image. Then hover over the image in the newly opened window. You will get a zoom icon, click the image with it and it will be displayed with better visibility. Read more…
Eclipse IDE Views Tips & Tricks
Eclipse IDE Productivity Tips & Tricks – Viewing:
In continuation to the previous post, this one has Tips & Tricks for Views in Eclipse IDE. Refer to posts in Eclipse Tips & Tricks for others.
Note: If the image displayed below is unclear, then click on the image. Then hover over the image in the newly opened window. You will get a zoom icon, click the image with it and it will be displayed with better visibility. Read more…
Developing Spring Application in Eclipse IDE
Spring Application Example:
Now that we have installed SpringIDE in Eclipse, let’s explore what we can do using Spring IDE and also create a Spring application. By integrating Spring IDE, we now have a Spring Project Wizard in the New Project option of Eclipse Workbench. We will start our Spring application with a demo project namely springide-demo. This is just to explore the SpringIDE features in Eclipse and not a tutorial on Spring application. This will help in getting started with our detailed tutorial ‘Exploring Spring Framework’ Series.
1. Creating a Spring Project:
- Open the New project dialog box by choosing File Menu > New and Choose Spring Project below in the Wizard.

- You will see the New Spring Project Dialog wizard. Here type the project name as “springide-demo” and keep all the options at their default values and click the Finish button.

- This will create a new Spring Project. SpringIDE provides visual indicators in the Package Explorer view which will be shown in Java Perspective. Note the S symbol upon the project name. This is to indicate that this is a Spring project.

2. Create a working package and class in the project: Read more…
SpringSource Tool Suite
What is SpringSource Tool Suite (STS)?
SpringSource Tool Suite has been a much awaited release from Spring Source. Interface21 (builders of Spring Framework) had partnered with Tasktop Technologies (builders of Eclipse Mylyn) to develop Spring Tool Suite, with the goal of reducing complexity in Java development and maintenance. Mylyn is an open source Eclipse project (task-focused UI for Eclipse that reduces information overload and makes multi-tasking easy) while Spring is a popular open source framework for enterprise Java. Built on Eclipse and Mylyn, Spring Tool Suite simplifies the large aggregation of tools used to develop complex enterprise Java applications.
This suite includes Spring IDE, the AspectJ Development Tools (AJDT), AspectJ, and Mylyn to create a task-focused approach to the development of Spring-powered enterprise applications. When Integrated development environments (IDEs) are used for large enterprise applications, they flood developers with tens of thousands of artifacts, wasting productive time by forcing developers to constantly find and identify the information relevant to the task at hand. In addition, the enterprise developer’s IDE consists of many tools that do not provide a unified workflow. While the Spring Framework and Portfolio projects already integrate many key technologies at the framework and library level, there is currently no tool solution that provides Mylyn’s task focus, tool integration, and workflow streamlining benefits to enterprise application developers. Building on the existing success of Eclipse, Mylyn and Spring IDE, the Spring Tool Suite will simplify the complexity dramtically.
Spring Source Quotes:
SpringSource Tool Suite™ (STS) provides the best Eclipse-powered development environment for building Spring-powered enterprise applications. STS includes tools for all of the latest enterprise Java and Spring based technologies as well as the most advanced tooling available for enterprise OSGi development. STS supports application targeting to local, virtual and cloud-based servers and provides built in support for SpringSource dm Server and tc Server. SpringSource Tool Suite is freely available for development and internal business operations use with no time limits.
What’s available in STS? Read more…
Spring Integration with Eclipse – SpringIDE
Spring Framework Integration with Eclipse IDE:
Now that we have downloaded Spring Framework, we will see how to integrate it with Eclipse IDE.
Eclipse IDE by default is just a platform for development, which doesn’t carry all the JEE features required. It doesn’t ship with support for Spring Framework as you would know by now. So we will see how to integrate Spring Framework with Eclipse IDE using a standard plugin available called SpringIDE. Eclipse IDE is available in different releases, and these steps are almost similar to all of them. This post demonstrates using Eclipse Galileo (Eclipse version 3.5.0 release). If you have any doubts related to Eclipse IDE releases or its download / installation / configuration, refer to Eclipse IDE Installation & Configuration post.
What is Spring IDE?
SpringIDE provides a user interface for Spring configuration files, built as a set of plugins on the Eclipse platform. It is a set of free plugins for the Eclipse platform that helps in developing Spring Application. The IDE provides a wizard for creating Spring projects, and using the Graphical Editing Framework, displays graphs of all beans (objects) and relationships either within a single configuration file or within a set of configuration files. The files, or sets, are also validated as they are added / modified. There’s also support for Spring AOP, so pointcut expressions are validated in your Spring configuration.
Spring IDE (http://www.springsource.com/products/springide) is a product from Spring Source (http://www.springsource.com/). Refer to Spring Primer for details. Latest SpringIDE version avaiable is 2.0.3.
Follow the steps below: Read more…
Things to know about Spring Download, Installation & Configuration
Things to know about download/installation/configuration of Spring Framework:
The Spring Framework and container is packaged in several JAR files. Spring is a library(.jar files) of classes that will be packaged with and used by your Spring-enabled applications. Installing Spring involves adding one or more JAR files to your application’s classpath. It does not have an executable runtime. Therefore, Spring is more similar to a library like Jakarta Commons than an application server like JBoss.
How you make Spring available to your application’s classpath will vary depending on how you build and run your application. You may choose to add the Spring JAR files to your system’s classpath or to a project classpath in your favorite IDE (as we will see in the post on configuring Spring Framework with Eclipse). If you’re building your application using Ant or Maven, be certain to include Spring in your build’s dependencies so that it will be included in the project’s target deployment.
Downloading Spring:
There’s plenty of additional materials in Spring’s full distribution, including Spring’s API documentation, examples, and the full source code for the Spring Framework. Therefore, the first thing you’ll want to do is to download the full Spring distribution. Refer to Spring Framework Installation & Configuration post. When downloading Spring, you will have 2 main choices: you can either download a Spring distribution that comes with its own dependencies or you can download a distribution that contains only the Spring JAR files. Even though the former is a much larger download, its better to download the one that comes with dependencies so that you won’t have to hunt down other JAR files that your application needs.
Exploring the Spring distribution:
Once you’ve downloaded the distribution, unzip it to a directory on your local machine. The Spring distribution is organized within the directory structure described in the table below. Several of these directories contain the Spring source code. The aspectj/,mock/, src/, and tiger/ directories contain the source code that makes up the Spring Framework itself. Meanwhile, the test/ directory contains the unit tests used to test Spring Framework. Although it’s not essential to using Spring, you may want to venture around in these directories to see how Spring does its stuff.

The Spring developers are extremely talented coders and there will be probably a little something to learn by reviewing their code. The docs/ directory contains two important pieces of documentation. The reference document is an overview of the entire Spring Framework. Also, the JavaDocs for the entire Spring Framework can be found under docs/—you’ll probably want to add this as a bookmark in your web browser, because you’ll refer to it often. The samples/ directory contains a handful of sample Spring applications. Of particular note are the petclinic and jpetstore examples. Both of these applications highlight many important elements of the Spring framework.
Building your classpath: Read more…
Spring Download & Installation
Spring Framework Download & Installation:
At the time of this post, the latest Spring Framework release available to download is Spring Framework 3.0.0.RC2, which is a development release. Previous releases are also available for download such as Spring Framework 2.5.6.SEC01 which is the current production release. All you have to do is navigate to http://www.springsource.org/download, chose and download the Spring Framework release that you want to work with.
Since our posts on Exploring Spring Framework will be based on Spring Framework 2.5 production release, we will see the download and instruction steps for this release. Steps should be the same no matter what release you chose.
Download Instructions:
1. Navigate to http://www.springsource.org/download site, here you can download the Spring Framework release from the Spring Downloads section:

2. Once clicking on the download link, you will be presented with community / enterprise download of Spring Framework. Chose the community download option: Read more…
Why Spring Framework?
Why Spring Framework?
Since the widespread implementation of J2EE applications in 1999/2000, it has not been an unqualified success in practice. While it has brought a welcome standardization to core middle-tier concepts such as transaction management, many — perhaps most — J2EE applications are over-complex, take excessive effort to develop, and exhibit disappointing performance. EJB soon became a widely accepted enterprise solution. But as time passed, many could recognize the disadvantages of using EJB.
In EJB versions prior to 3.0, a single EJB component requires a remote/local interface, a home interface, and a bean implementation class. Hence EJBs were called heavyweight components. Moreover, in those EJB versions, an EJB component could only run within an EJB container and had to look up other EJBs with JNDI (Java Naming and Directory Interface). So EJB components were technology dependent because they could not be reused and tested outside the scope of an EJB container.
Spring framework hence came out to reduce such complexities in enterprise application development. You can think of Spring framework as, minus of EJB’s disadvantages plus a comprehensively layered modular Java/JEE framework which is flexible, light-weight, less intruisive and technology independent. Spring is applicable in a wide range of environments, not just server-side J2EE applications which was the original motivation. Spring also offers many valuable services for J2EE applications.
Problems with the Traditional Approach to J2EE:
Experience has highlighted specific causes of complexity and other problems in J2EE applications. (Of course, not all of these problems are unique to J2EE!) In particular:
- J2EE applications tend to contain excessive amounts of “plumbing” code. Many code reviews repeatedly reveal a high proportion of code that doesn’t do anything: JNDI lookup code, Transfer Objects, try/catch blocks to acquire and release JDBC resources. Writing and maintaining such plumbing code proves a major drain on resources that should be focused on the application’s business domain.
- Many J2EE applications use a distributed object model where it is inappropriate. This is one of the major causes of excessive code and code duplication. It’s also conceptually wrong in many cases. Internally distributed applications are more complex than co-located applications, and often much less performant. Of course, if your business requirements dictate a distributed architecture, you need to implement a distributed architecture and accept the trade-off that incurs (and Spring offers features to help in such scenarios). But you shouldn’t do so without a compelling reason.
- The EJB component model is unduly complex. EJB was conceived as a way of reducing complexity when implementing business logic in J2EE applications; it has not succeeded in this aim in practice.
- EJB is overused. EJB was essentially designed for internally distributed, transactional applications. While nearly all non-trivial applications are transactional, distribution should not be built into the basic component model.
- Many “J2EE design patterns” are not, in fact, design patterns, but workarounds for technology limitations. Overuse of distribution, and use of complex APIs such as EJB, have generated many questionable design patterns; it’s important to examine these critically and look for simpler, more productive, approaches.
- J2EE applications are hard to unit test. The J2EE APIs, and especially, the EJB component model, were defined before the agile movement took off. Thus their design does not take into account ease of unit testing. Through both APIs and implicit contracts, it is surprisingly difficult to test applications based on EJB and many other J2EE APIs outside an application server. Yet unit testing outside an application server is essential to achieve high test coverage and to reproduce many failure scenarios, such as loss of connectivity to a database. It is also vital to ensuring that tests can be run quickly during the development or maintenance process, minimizing unproductive time waiting for redeployment.
- Certain J2EE technologies have simply failed. The main offender here is entity beans, which have proven little short of disastrous for productivity and in their constraints on object orientation.
The traditional response to these problems has been to wait for tool support to catch up with the J2EE specifications, meaning that developers don’t need to wrestle with the complexity noted above. However, this has largely failed. Tools based on code generation approaches have not delivered the desired benefits, and have exhibited a number of problems of their own. In this approach, you might generate all those verbose JNDI lookups, Transfer Objects, and try/catch blocks.
In general, experience has shown that frameworks are better than tool-enabled code generation. A good framework is usually much more flexible at runtime than generated code; it should be possible to configure the behavior of one piece of code in the framework, rather than change many generated classes. Code generation also poses problems for round-tripping in many cases. A well-conceived framework can also offer a coherent abstraction, whereas code generation is typically just a shortcut that fails to conceal underlying complexities during the whole project lifecycle. (Often complexities will re-emerge damagingly during maintenance and troubleshooting.)
A framework-based approach recognizes the fact that there is a missing piece in the J2EE jigsaw: the application developer’s view. Much of what J2EE provides, such as JNDI, is simply too low level to be a daily part of programmer’s activities. In fact, the J2EE specifications and APIs can be judged as far more successful, if one takes the view that they do not offer the developer a programming model so much as provide a solid basis on which that programming model should sit. Good frameworks supply this missing piece and give application developers a simple, productive, abstraction, without sacrificing the core capability of the platform.
Using J2EE “out of the box” is not an attractive option. Many J2EE APIs and services are cumbersome to use. J2EE does a great job of standardizing low-level infrastructure, solving such problems as how can Java code access transaction management without dealing with the details of XA transactions. But J2EE does not provide an easily usable view for application code.That is the role of an application framework, such as Spring.
Recognizing the importance of frameworks to successful J2EE projects, many developers and companies have attempted to write their own frameworks, with varying degrees of success. In a minority of cases, the frameworks achieved their desired goals and significantly cut costs and improved productivity. In most cases, however, the cost of developing and maintaining a framework itself became an issue, and framework design flaws emerged. As the core problems are generic, it’s much preferable to work with a single, widely used (and tested) framework, rather than implement one in house.
No matter how large an organization, it will be impossible to achieve a degree of experience matching that available for a product that is widely used in many companies. If the framework is open source, there’s an added advantage in that it’s possible to contribute new features and enhancements that may be adopted. (Of course it’s possible to contribute suggestions to commercial products, but it’s typically harder to influence successful commercial products, and without the source code it’s difficult to make equally useful contributions.) Thus, increasingly, generic frameworks such as Struts and Hibernate have come to replace in-house frameworks in specific areas.
The Spring Framework grew out of this experience of using J2EE without frameworks, or with a mix of in-house frameworks. However, unlike Struts, Hibernate, and most other frameworks, Spring offers services for use throughout an application, not merely in a single architectural tier. Spring aims to take away much of the pain resulting from the issues in the list we’ve seen, by simplifying the programming model, rather than concealing complexity behind a complex layer of tools.
Spring enables you to enjoy the key benefits of J2EE, while minimizing the complexity encountered by application code.The essence of Spring is in providing enterprise services to Plain Old Java Objects (POJOs). This is particularly valuable in a J2EE environment, but application code delivered as POJOs is naturally reusable in a variety of runtime environments.
Spring in Context:
Spring is a manifestation of a wider movement. Spring is the most successful product in what can broadly be termed agile J2EE. While Spring has been responsible for real innovation, many of the ideas it has popularized were part of the zeitgeist and would have become important even had there been no Spring project. Spring’s greatest contribution — besides a solid, high quality, implementation — has been its combination of emerging ideas into a coherent whole, along with an overall architectural vision to facilitate effective use.
Inversion of Control and Dependency Injection: Read more…
Spring Framework Primer
Spring Framework Primer
The Spring Framework is an open source application framework, for the Java platform and also the .NET Framework (Spring.NET). The first version was written by Rod Johnson who released the framework with the publication of his book Expert One-on-One J2EE Design and Development in October 2002. The framework was first released under the Apache 2.0 license in June 2003. The Spring 1.2.6 framework won a Jolt productivity award and a JAX Innovation Award in 2006. The current Spring framework version is 3.0.
VMware acquired SpringSource for approximately $362 million on September 16, 2009.
Spring was created to address the complexity of enterprise application development. One of the chief advantages of the Spring framework is its layered architecture, which allows you to be selective about which of its components or modules you want to use for your application development. Unlike single-tier frameworks, such as Struts or Hibernate, Spring aims to help structure whole applications in a consistent, productive manner, pulling together best-of-breed single-tier frameworks to create a coherent architecture.
The core features of the Spring Framework can be used by any Java application, but there are extensions for building web applications on top of the Java Enterprise platform. Although the Spring Framework does not impose any specific programming model, it has become popular in the Java community as an alternative, replacement, or even addition to the Enterprise JavaBean (EJB) model.
Spring is unique for several reasons:
-
It addresses important areas that other popular frameworks don’t. Spring focuses around providing a way to manage your business objects.
-
Spring is comprehensive and modular (because of its modules). Spring has a layered architecture, meaning that you can choose to use just about any part of it in isolation, yet its architecture is internally consistent. So you get maximum value from your learning curve. For example: You might choose to use Spring only to simplify use of JDBC, or you might choose to use Spring to manage all your business objects.
-
It’s easy to introduce Spring incrementally into existing projects.
-
Spring is designed from the ground up to help you write code that’s easy to test. Spring is an ideal framework for test driven projects.
-
Spring is an increasingly important integration technology, its role is recognized by vendors both large and small.
-
Spring also addresses most infrastructure concerns (cross-cutting concerns such as logging, security etc) of typical applications.
Architectural benefits of Spring:
Let’s look at some of the benefits Spring can bring to your project:
-
Spring can effectively organize your middle tier objects. Spring takes care of plumbing that would be left up to you if you use only Struts or any other framework that use J2EE APIs.
-
Spring’s configuration management services can be used in any architectural layer, in whatever runtime environment.
-
Spring can eliminate the increase of Singletons used in many projects. This is a major problem that reduces testability and object orientation.
-
Spring eliminates the need to use a variety of custom properties file formats, by handling configuration in a consistent way throughout the application.
-
Spring facilitates good programming practice by reducing the cost of programming to interfaces rather than classes.
-
Spring is designed so that applications built with it depend on as few of its APIs as possible. Most business objects in Spring applications have no dependency on Spring.
-
Applications built using Spring are very easy to test. For certain unit testing scenarios, the Spring Framework provides mock objects and testing support classes. Spring also provides unique “integration testing” functionality in the form of the Spring TestContext Framework and legacy JUnit 3.8 support classes that enable you to test your code quickly and easily, even while accessing a staging database.
-
Spring helps you solve problems though being a most lightweight possible infrastructure. Spring provides an alternative to EJB that’s appropriate for many applications. For example, Spring can use AOP to deliver declarative transaction management without using an EJB container; even without a JTA implementation.
-
Spring provides a consistent framework for data access, whether using JDBC or an O/R mapping product such as TopLink, Hibernate or a JPA or JDO implementation.
Spring is essentially a technology dedicated to enable building applications using Plain Old Java Objects (POJOs). It enables you to develop components as POJOs containing only your business logic, while the framework takes care of the many value adds you need while building enterprise applications — even in areas that you may not have considered when initially authoring the application. This goal requires a sophisticated framework, which conceals much complexity from the developer.
Since your business logic is abstracted from infrastructure concerns, it’s also likely to enjoy a longer life. As the business logic is abstracted from the infrastructure concerns, any changes to the inevitable infrastructure change (such as choice of application server) can be minimized. Thus Spring can enable you to implement the simplest possible solution to your problems. And that’s worth a lot.
What does Spring do? Read more…
Spring Framework Introduction
Chapter 2: Introduction to Spring
Spring Framework:
The Spring framework is a comprehensive layered Java/Java EE application platform. It was created to address the complexity of enterprise application development. The Spring Framework takes best practices and design patterns that have been proven over the years, codifies these patterns as first class objects that can be integrated into applications. Spring makes it possible to use plain-vanilla Java Beans (POJOs) to achieve things that were previously only possible with EJBs.
Spring includes:
-
An IOC lightweight container
-
AOP functionality
-
Abstraction layer for JDBC / transaction management
-
ORM integration layer
-
Web integration layer
-
A flexible MVC web application framework
Spring is not only an application framework, it also serves as a platform for several open source projects that are based on the core Spring Framework project such as Spring IDE, Spring Security, Spring Web Flow, Spring Web Services, Spring Rich Client, Spring Batch, Spring Modules, Spring Dynamic Modules, Spring Integration, Spring LDAP, Spring JavaConfig, Spring .NET, Spring BeanDoc.
Spring’s features:
Framework:
Spring makes it possible to develop and maintain complex applications using simple components. In Spring, application objects are configured declaratively typically in an XML file. Spring also provides much infrastructure functionality (transaction management, integration, etc.), leaving only the development of application logic to you.
Lightweight:
Spring is lightweight in terms of both size and overhead. Spring Framework can be distributed in a single JAR file that weighs just over 2.5 MB and the processing overhead required by Spring is negligible. Spring is non intrusive in a way that the objects in a Spring-enabled application often have no dependencies on Spring-specific classes.
Container:
Spring provides a container which contains and manages the lifecycle and configuration of application objects. In Spring, you can declare how each of application objects should be created, how they should be configured, and how they should be associated with each other.
Dependency Injection:
Spring promotes loose coupling through dependency injection (DI). When DI is applied, objects are passively given their dependencies instead of looking for dependencies themselves. You can think of DI as JNDI in reverse — instead of an object looking up for dependencies from a container, the container gives the dependencies to the object at its instantiation without waiting to be asked.
Aspect-oriented:
Spring comes with rich support for aspect-oriented programming (AOP) that enables separating application business logic from system services (such as auditing, transaction management, logging etc). Application objects do what they’re supposed to do i.e., perform business logic — and nothing more. They are not responsible for or even be aware of other system concerns, such as logging or transactional support.
Spring Framework Architecture: Read more…
Spring Framework Terminologies
Chapter 1: Terminologies
Design Patterns:
A design pattern is a conceptual general reusable solution to a commonly occurring problem in software design. A design pattern can’t be transformed directly into code. It is a template for how to solve a problem that can be used in many different situations. Design patterns such as Factory, Builder, Decorator, and Service Locator (to name a few) have widespread recognition and acceptance within the software industry. Design patterns are best practices given a name that describe what the pattern does, where the pattern is best applied and the problems that the pattern addresses etc.
Framework:
Framework is a step ahead of design patterns. It is basically a conceptually organized structure based on best practices and design patterns to address complex issues. A software framework is an abstraction in which generic functionality can be selectively overridden, specialized or extensible by user code. Frameworks are similar to software libraries in way that they are reusable code wrapped in a well-defined API. However unlike libraries, the overall program’s flow of control is not dictated by the caller, but by the framework. This inversion of control is the distinguishing feature of software frameworks.
Object-Oriented Frameworks:
An object-oriented framework is a semi-finished object-oriented application laid out on OOPS concepts such as Inheritance, Polymorphism, Abstraction and Encapsulation. Object-oriented design patterns typically show relationships and interactions between classes or objects. It encapsulates common features that can be used across the same application or even different applications. Common examples of such frameworks include Apache Struts, JSF, and Spring etc. A framework-driven approach to application development usually involves integration of multiple object-oriented frameworks and creation of specific functionalities as extensions to these frameworks.
Every framework provides its own extension points called hotspots. Hotspots are specific to a framework, usually pertaining to integration (application programming/service provider interfaces) and configuration (external metadata). For example, the EJB 2.0 specifications define hotspots for Java bean objects to be deployed in an EJB container.
Inversion of Control:
Inversion of control is a generic principle and not a design pattern. Rather, it is a broad concept that is implemented by several design patterns.
Inversion of control is applied during communication between a framework and custom application logic. A common feature of frameworks is to maintain control of all communication activities within an application because of which the primary objective of an application module will only be to provide functionalities that can be invoked by the framework. Compare this to a scenario without frameworks, in which there is a significant effort on how the modules can invoke and manage each other.
Application modules won’t have to directly access each other’s capabilities when deployed on top of a framework. The same is also true for invocations from external entities. Instead, every request must be routed through the framework. The framework, in turn, can make multiple calls across more than one module in a controlled fashion before returning a result back to the caller.
In the light of what has been said so far, inversion of control can be summed up as:
“Don’t call us (framework); we’ll call you (application)”
Service Locator pattern: Read more…
Exercise 2 – Using overloaded methods in Java
Exercise – 2 for module 3 of Using operators and decision constructs:
This post has the exercise – 2 for module 3 of Using operators and decision constructs. Let’s practice what we have learnt. Before practicing the exercise, follow the instructions below which will give you a step-by-step instruction:
You can download the source code (WJ-1103A-module3-exercise2.zip) for this exercise from the Box widget in the sidebar. Follow the video tutorial below if you ever get stuck while executing the programs. Read more…
Exercise 1 – Using arguments and return values in Java
Exercise – 1 for module 3 of Using operators and decision constructs:
This post has the exercise – 1 for module 3 of Using operators and decision constructs . Let’s practice what we have learnt. Before practicing the exercise, follow the instructions below which will give you a step-by-step instruction:
You can download the source code (WJ-1103A-module3-exercise1.zip) for this exercise from the Box widget in the sidebar. Follow the video tutorial below if you ever get stuck while executing the programs. Read more…
Developing & using methods in Java
Module 3: Developing & using methods
Objectives:
-
Describe the advantages of methods and define worker and calling methods.
-
Declare and invoke a method.
-
Compare object and static methods.
-
Use overloaded methods.
1. Describe the advantages of methods and define worker and calling methods:
Creating and invoking methods:
Let’s begin our discussion of methods by looking into the syntax required to declare a method in a class.
[modifiers] -> The modifiers are optional keywords that modify the behavior of a method. Some of these modifiers are the keywords, public, private, protected and static. We will look into all of them in the coming posts.
return_type -> First thing that all the methods should have is the return type. Every method can return utmost one value. If the method does not return anything, then the method must specify the keyword void. If it does return a value, the value can either be primitive or a object reference. For instance, if the method returns an integer, then the return type should be specified as int, if the method returns an object such as String, then the return value should be specified as String.
method_identifier -> This is the name that you assign to a method such as displayShirtInformation.
Then we have the paranthesis and inside of it we have arguments. The paranthesis are always required whether we have arguments or not.
[arguments] -> The arguments are optional. This will be a list of variables, whose values will be passed into the method as input. The method can then use those values to do something with them, such as print them to the console etc.
Then we have the left and right curly brace, enclosing the method_code_block. These are always required.
method_code_block -> These are lines of Java code, that you will want to be executed when the method is called.
Basic form of a method:
Let’s take a look at an example of method declaration. Here we have a class called Shirt inside of which we have a method called displayShirtInformation() that’s been declared. Notice the optional modifier public specified indicating that this method can be invoked from anywhere, the return type void specifying that the method doesn’t return anything, then the name of the method displayShirtInformation followed by a pair of paranthesis which is empty i.e., specifying that the method doesn’t take any arguments. Then we have the left curly brace which encloses the code block of Java code that we want to be executed whenever this method is called. And then we have a terminating right curly brace specifying the end of method body.

To the right, we have a class called ShirtTest. Inside of it we have a method called main method. Notice the optional modifier public specified indicating that this method can be invoked from anywhere. We also have static. You can have valid multiple combination of modifiers in the method declaration. We will cover it all in detail in the coming posts. Then we have the return type void indicating that this method doesn’t return anything. Then we have the method identifier as main. As we know from before, this is the entry point into a Java program.
Then we have the paranthesis enclosing one argument. We have an array of Strings called args that will be passed to this method. We will talk about arrays in posts to come. Then we have our left curly brace beginning our method body, then we have our lines of Java code that are to be executed whenever this method is called. And then we end the method body by closing the braces.
Notice that on line 9, the code is invoking displayShirtInformation() method in the Shirt class. So in this case the main method is called the calling method or the caller method whereas the displayShirtInformation() method is called as the worker method. When one method calls another, the calling method is called the caller method, and the called method is called the worker method.
Also, notice how we have called the displayShirtInformation() method. We have used the Shirt object reference called myShirt and the dot notation (.) and the name of the method. When one class wants to call a method in another class, it needs an object reference of that class to invoke a method in that class.
Guidelines for invoking methods: Read more…
Exercise 3 – Using do while loop in Java
Exercise – 3 for module 2 of Using operators and decision constructs:
This post has the exercise – 3 for module 2 of Using operators and decision constructs . Let’s practice what we have learnt. Before practicing the exercise, follow the instructions below which will give you a step-by-step instruction:
You can download the source code (WJ-1103A-module2-exercise3.zip) for this exercise from the Box widget in the sidebar. Follow the video tutorial below if you ever get stuck while executing the programs. Read more…
Exercise 2 – Using for loop in Java
Exercise – 2 for module 2 of Using operators and decision constructs:
This post has the exercise – 2 for module 2 of Using operators and decision constructs . Let’s practice what we have learnt. Before practicing the exercise, follow the instructions below which will give you a step-by-step instruction:
You can download the source code (WJ-1103A-module2-exercise2.zip) for this exercise from the Box widget in the sidebar. Follow the video tutorial below if you ever get stuck while executing the programs. Read more…
Exercise 1 – Using while loop in Java
Exercise – 1 for module 2 of Using operators and decision constructs:
This post has the exercise – 1 for module 2 of Using operators and decision constructs. Let’s practice what we have learnt. Before practicing the exercise, follow the instructions below which will give you a step-by-step instruction:
You can download the source code (WJ-1103A-module2-exercise1.zip) for this exercise from the Box widget in the sidebar. Follow the video tutorial below if you ever get stuck while executing the programs. Read more…
Using loop constructs in Java
Module 2: Using loop constructs:
Objectives:
-
Create while loops.
-
Develop for loops.
-
Create do / while loops.
1. Create while loops:
The while loop is used to execute a set of code for multiple times as long as a condition is true. Once the condition becomes false, the code block is no longer executed and the control exits the while loop and continues with the execution of rest of the program.

We can see the syntax for the while loop in the syntax figure above. We begin with the keyword while, and then we put a boolean expression inside a set of paranthesis. If this boolean expression is true, we execute the code block between the left and the right curly braces. If the boolean expression is false, then we do not execute the code block and we leave the while loop. This code block will be executed as many number of times as long as the boolean expression continues to be true.
This is illustrated in a flow chart to the right. The boolean expression is tested for true / false. If true, then we execute the code block, and you can also see that we return back to again test the boolean expression after executing the code block, and again the expression will be tested for true / false. As long as the boolean expression continues to be true, the flow will be the same. Once the expression evaluates to false, the code block will no longer be executed and the control leaves the while loop.
While loop example:
Let’s take a look at an example of while loop. As you can see from the figure below, we have a while loop that is checking if the variable i is less than 5. If it is, we will enter the code block, and we will print out “Hello Thomas” to the command prompt / console. And then we are incrementing the i variable by 1. We will then again go back to the while loop condition and check if the i variable is still less than 5. As long as it is, we will continue to print to the console and continue to increment i and continue back to the while loop condition. Once its not, we will leave the while loop and continue with the rest of the program. Let’s see this for 2 different values of i.
For i = 0:

When i = 0, the while condition is true for the first time, and we enter the loop and print “Hello Thomas” to the console, increment i by 1 because of which it becomes 1, and again go back to the while loop condition and check it again. Here i is 1 and still less than 5 so the whole loop is repeated for 5 times until i < 5 and “Hello Thomas” is printed 5 times to the console. Once i is 5, i < 5 will be false so it will exit the while loop and continue with the execution of the rest of the program.
For i = 5:

When i = 5, we check the while loop condition first, which is i < 5, as we have i as 5, we get this condition to be false. Hence we wont enter the code block, hence not printing anything to the console and continue with the execution of rest of the program.
Nested while loops: Read more…
Exercise 2 – Using switch construct in Java
Exercise – 2 for module 1 of Using operators and decision constructs:
This post has the exercise – 2 for module 1 of Using operators and decision constructs. Let’s practice what we have learnt. Before practicing the exercise, follow the instructions below which will give you a step-by-step instruction:
You can download the source code (WJ-1103A-module1-exercise2.zip) for this exercise from the Box widget in the sidebar. Follow the video tutorial below if you ever get stuck while executing the programs. Read more…
Exercise 1 – Using if and if else in Java
Exercise – 1 for module 1 of Using operators and decision constructs:
This post has the exercise – 1 for module 1 of Using operators and decision constructs . Let’s practice what we have learnt. Before practicing the exercise, follow the instructions below which will give you a step-by-step instruction:
You can download the source code (WJ-1103A-module1-exercise1.zip) for this exercise from the Box widget in the sidebar. Follow the video tutorial below if you ever get stuck while executing the programs. Read more…
Using operators and decision constructs in Java
Module 1: Using operators and decision constructs.
Objectives:
- Identify relational and conditional operators.
- Create if and if / else constructs.
- Use the switch construct.
1. Identify relational and conditional operators:
In everyday life, we make many decisions. For instance, if its raining I will use umbrella so that I dont get wet. This is a type of branching. If one condition is true, that’s if raining, I take my umbrella. If the condition is not true but false, then I will not take my umbrella. This type of branching decision making can be implemented in Java programming using ‘if’ statements.
But before we can discuss about “if” statements, we need to know about relational operators. Because in Java to make a decisions you have to test the relationship between things.
Relational operators:
The following is the relational table which shows the relational operators in Java. As the name relational implies, it says how 2 things are related to each other. All the operators listed here are binary operators. What this means is, they always work on 2 things which are left and right operands. These operators will compare the 2 operands together and returns is a boolean value, a true or false value. For ex, the == operator tells us if the 2 operands are equal, if they are it returns a true value, if not it returns a false value.

In the above example,
int i=1;
if(i==1), will return true.
Similarly we have different operators such as not equal to, less than, less than or equal to, is greater than and greater than or equal to operators. These operators are not going to sit by themselves and we are going to use them in the “if” statements.
Conditional operators:
A lot of times in Java we just want to ask very simple question, such as ‘is x greater than 2′. But there are other times when we want to ask bit complicated questions. For example, in real life we might want to ask something like “if its raining and if its muddy outside, i will take my umbrella and my boots”. To do this in Java we use the conditional operators. We have AND, OR and NOT operators to implement the conditional operations as shown in the table.

The AND and the OR are binary operators just like the relational operators were, that means that they have left and right operands and they also return true / false. The NOT is a unary operator, it only takes 1 operand and it also returns a true / false.
For the AND operator to return true, both the left and the right operand have to evaluate to true. If either one of them are false, it will return a false. For the OR operator, if either side of the operator evaluate to true, then the operator returns a true. If both of the operands are false, then it will return false. For the NOT operator, it basically just reveres the boolean value of the single operand. That is if a NOT value is applied to a true value then it returns false, and if its applied to a false value then it returns true. We shall take a look at some examples to better understand them.
Lets start with the AND operator represented by double ampersand (&&)
ex:
int i = 2;
int j = 8;
An && operator needs a true/false value on the left hand side and a true/false value on the right hand side. So one way to do that is using relational expressions, because we know relational operators return true or false.
((i<1)&&(j>6))
So, here on the left hand side we have, “is i < 1″, and as i = 2 and hence i is not less than 1, we get false. So the whole expression now will be false. Java doesnt even have to evaluate the expression on the right hand side here because for && operator to return true, both the operands have to be true. So, the minute it finds a false value, it returns false.
true && true = true
true && false = false
false && false = false
false && true = false
Lets take a look at the OR example represented by (||)
ex:
int i = 2;
int j = 8;
Again, || operator needs both sides to be true / false values.
((i<1)||(j>=10))
So here, i<1 is false. At this point it cant determine if it has to return true / false for the whole expression. So, it also has to check the right hand side. So j>=10, this is false. So both sides of the OR expression is false. so it returns false.
true || true = true
true || false = true
false || false = false
false || true = true
Lets take a look at the NOT operator represented by (!)
ex:
int i = 2;
(!(i>3))
Here we are first asking the question, i>3. it is not. so its false. But here we are applying the NOT operator. So, NOT operator returns reverse which is true.
!true = false
!false = true
2. Creating if and if / else constructs: Read more…
Exercise 2 – String class in Java
Exercise – 2 for module 2 of Beginning to Program with the Java Programming Language:
This post has the exercise – 2 for module 2 of Beginning to Program with the Java Programming Language. Let’s practice what we have learnt. Before practicing the exercise, follow the instructions below which will give you a step-by-step instruction:
You can download the source code (WJ-1102A-module2-exercise2.zip) for this exercise from the Box widget in the sidebar. Follow the video tutorial below if you ever get stuck while executing the programs. Read more…
Exercise 1 – Creating Test class in Java
Exercise – 1 for module 2 of Beginning to Program with the Java Programming Language:
This post has the exercise – 1 for module 2 of Beginning to Program with the Java Programming Language . Let’s practice what we have learnt. Before practicing the exercise, follow the instructions below which will give you a step-by-step instruction:
You can download the source code (WJ-1102A-module2-exercise1.zip) for this exercise from the Box widget in the sidebar. Follow the video tutorial below if you ever get stuck while executing the programs. Read more…




Eclipse IDE Editing Source Trips & Tricks
Eclipse IDE Productivity Tips & Tricks – Editing Source:
Okay, we might know about few or most of these from everywhere, also might already have this list handy as this comes straight out of Eclipse help tutorial. But I am posting here so that this can be available anytime on the move. The following tips and tricks give some helpful ideas for increasing productivity while working on Eclipse IDE. These tips & tricks can be grouped into 7 main categories namely:
This post has Editing Source Tips & Tricks. Refer to posts in Eclipse Tips & Tricks for others. Read more…