Posts tagged spring

SMTP: Spring Mail To Program

All Java developers know, or should know, the Spring framework contains a lot of gems. Recently I discovered a new gem: an easy way to send an email. With the use of one single POJO mail class, you can easily let your application send an email and wire/inject al the mail configuration with the Spring applicationContext.xml.
Read the rest of this entry »

Configure JDeveloper 11g to work with Spring 2.5 and AOP

In a recent article I described the interaction between JavaServer Faces (1.2) and Spring Framework (2.5.x): http://technology.amis.nl/blog/6655/spring-a-surprise-on-a-jsf-developer-how-spring-beans-can-become-jsf-managed-beans. I created a JDeveloper 11g web application that I ran on the integrated WebLogic Server 11g (10..3.2). In this article I will explain the configuration steps I had to go through for making JDeveloper and WebLogic run my simple JSF/Spring application.

1. Create a new generic JDeveloper application; set the project name and add the JSF library

2. Install the JDeveloper Spring extension through the Check for Updates facility under Help in the main menu

Read the rest of this entry »

Spring a surprise on a JSF developer – how Spring beans can become “JSF Managed Beans”

Recently I was looking at a JavaServer Faces application, that did something relatively simple – but was exhibiting strange behavior. The output shown on the page (and this is a simplified version of the real life situation) was:

dlroWolleH

I had been asked to look into the situation and correct it. Before starting to make any changes I decided to familiarize myself with the application as it currently was. And then they almost tricked me.

The JSF page had a simple outputText component with an EL Expression in its value attribute. Something like:

<h:outputText value="#{someBean.property}"/>

I decided to take a look at the code for that bean, to understand the logic behind deriving the value of the outputText. So I first opened the faces-config.xml file to find the managed bean declaration that would tell me which class definition was behind the bean included in the EL expression. However, the faces-config.xml did not contain any managed bean definitions at all. None. And yes, I tried to see whether the web.xml specified any other faces-config.xml alternatives. But it did not.

Slowly it dawned on me Read the rest of this entry »

Project Experience with Acegi Security, Spring MVC and Oracle MapViewer

For a customer with an interesting business we had to build a web application that has a RIA front end, displays data on maps, authenticates thru a web service that is connected with a back office customer subscription system, and that can handle any kind of data (for example shops, garages or whatever) as long as it conforms to a certain format. Depending on the specific dataset the application is configured in a different way and behaves differently. I call it a meta data driven application.

Anyway, taken all these aspects together, the building process has been an exciting adventure. From all frameworks we took the latest versions, and came up with the following tech stack: Spring 2.0, Acegi Security System 1.0, Dojo Javascript toolkit, Oracle (Ajax based) MapViewer 10.1.3.1 (released a month ago!) and Oracle 10g database. Spring formed the ecosystem for our application in which we plugged the Javascript presentation layer at the front end, and the unbreakable Oracle database at the back end. In the same container the Oracle MapViewer application is running. Ajax calls are made from the main application to mapViewer server in order to manage map standard behavior like panning and to display fields of interest (FOIs). Apart from these larger components of the architecture, there are other technologies used, for instance: Xfire Java SOAP framework, Commons file upload, JFreeChart, Junit, Log4j and more (yeah, Bruce Tate is probably right when he states in Beyond Java, that
developing a web application nowadays involves too many technologies and frameworks). Looking at this technological cathedral, I just like to mention – in the story below – some parts and experiences that I personally liked or disliked. The different subjects below are:

  • Upgrading from Acegi Security version 0.8 to 1.0
  • Providing authentication in Acegi Security by a webservice
  • Integrating Spring SimpleFormController and Dojo dojo.io.FormBind
  • Using Javascript API of Oracle Mapviewer.

Read the rest of this entry »

Spring 2.0 in Oracle JDeveloper

On Oracle OTN Shay Shmeltzer has written an article that explains how to use the Spring framework within JDeveloper and how to best setup JDeveloper for Spring 2.0. Interface21 has announced that the final release of Spring 2.0 is planned onSeptember 26th, 2006.

http://www.oracle.com/technology/products/jdev/howtos/1013/SpringwithJDev/index.html

Shay will show “(…) some of the nice features that JDeveloper provides for Spring developers out of the box.” Getting exited?

Meta Data Driven User Interface with Dojo and Spring MVC

What I mean with a meta data driven user interface is an application whose appearance and behavior is managed by a special set of data that is stored in a database and that is linked to attributes of the user. For instance the organization to which the user belongs has a contract whith the web application provider that enables the user to get certain types of information and disables other types. Therefore, a user interface widget, as for example a tree, should display nodes according to the set meta data that is connected to this user. Question is now how set up this stuff using Dojo for the presentation layer and Spring for the server side?

.... Read the rest of this entry »

Verslag van SpringOne

Op 15 en 16 juni vond in Antwerpen de SpringOne conferentie plaats. Dit event bestond uit vier keynotes, zes zogenaamde university talks, veertig (parallelle) presentaties en 48 sprekers. Dit alles werd bezocht door zo’n 400 ontwikkelaars en andere belangstellenden, afkomstig uit maar liefst 25 landen. In de gangen en zalen hoorde ik veel Engels, Frans, Duits, Italiaans, Spaans, Slavisch en Nederlands. Dit was de eerste conferentie in Europa die specifiek is gericht op het Spring platform. Het grote bezoekersaantal is een indicatie voor de huidige positie in de Java arena, die door Rod Johnson, de grondlegger van Spring, werd aangeduid als “world’s favorite application framework”..... Read the rest of this entry »

Map Adventures with Google, Oracle and Spring

In summer 2000 I started in the Field Service development team of Oracle’s eBusiness Suite (http://www.oracle.com/applications/service/srvonl_cont.html). The web form Dispatch Center contains four Java applets. One of them is a map. This map displays the location of the customers and the current position of the field service engineers who synchronize their mobile devices with a central database. The implementation of this map was quite problematic. Especially the performance caused severe headache. In 2005, five years and ten versions later, clicking the tab page of the map still was a receipt to freeze your application… then I saw Google Maps and I nearly fell from my chair. The performance is amazing. But also development work to integrate a map into an application is easy.

.... Read the rest of this entry »

SpringOne conference

Op 15 en 16 juni aanstaande wordt de SpringOne conferentie gehouden in Antwerpen. Dit is de eerste Europese conferentie die specifiek op het Spring Framework betrekking heeft. Het evenement bestaat uit 40 sessies  (in vier parallele series). Deze sessies worden gepresenteerd door de core developers van Spring and andere beroemdheden. Verder zijn er 5 hoofdlezingen, die onder meer worden gegeven door ‘the father of Spring’ Rod Johnson en aspect-oriented programming pioneer Gregor Kiczales.

De onderwerpen van de sessies zien er bijzonder interessant en nuttig uit! Enkele voorbeelden:

  • Spring Web Flow and JSF
  • Integrating Spring with the Oracle Application Development framework by Duncan Mills
  • Spring.NET
  • Practical quick start with Acegi Security
  • AOP in the enterprise
  • Ajax, DWR and Spring
  • TopLink and Spring
  • Patterns in Service-oriented architectures
  • Testing with Spring
  • Spring web services
  • The power of Spring transactions

en nog veel meer… zie www.springone.com

SpringOne

Pulling the rug from under your feet while keeping standing – Using the Hot Swappable Target Source in Spring AOP

Spring AOP offers a wealth of new options in programming as well as designing Java applications. A somewhat more advanced feature is the Hot Swappable Target Source. The concept of a hot swappable target source is linked to the use of proxies instead of concrete object implementations, which is the heart of standard, run-time JDK based AOP. To advise an object with aspects, such as described in my previous post Getting into Spring AOP – Implementing simple business logic on top of Domain Objects using Aspect Oriented Programming, a proxy is created. This proxy intercepts method calls intended for the underlying target object and applies aspects for all specified pointcuts. Usually the wrapped target object still gets called somewhere in the middle of executing all the aspects that were advised. Note that the code using the proxy is not aware of the fact that it is not using a 'normal' implementation of the interface it is programmed against but instead a proxy. It does not matter for the code; only when you ask for the myobject.getClass() will get quite another classname than you would expect. However myobject instanceof interface will still result in true. Suppose we have advised an object implementing the Employee interface. The advise adds some validation logic that is executed just prior to invoking the set-methods on the Employee interface (for example to ensure that Salesmen do not get paid too much and that no employee is called John Doe). Since the code using the object is now in reality using a proxy that itself refers a 'real' EmployeeImpl object (EmployeeImpl is a class that implements the Employee interface), it should theoretically be possible to swap one EmployeeImpl currently use as proxy target with another one. Without the program noticing it, it would all of a sudden deal with a completely new underlying object. We will first show that such a thing is indeed possible – and in a fairly simple manner, and then we will discuss why you might one to do something like that. Read the rest of this entry »