Spring Archives - Intertech Blog

Spring Security Active Directory LDAP Example

At a recent client, I was tasked with securing their web applications using Spring Security and their internal Active Directory (AD) LDAP server. I scoured the web and went through a lot of trial and error until I finally found the configuration that worked in their environment.  Based on some of the comments and questions I found on the web, the problems that I was facing seemed to be shared by others. Here’s a Spring Security Active Directory example to show how… Read More

Spring Integration – Enterprise Integration Veg-O-Matic

Do you remember some of those crazy kitchen utensil commercials during the 70’s and 80’s?  One of my favorites was the Veg-O-Matic.  The slogan for that tool was that “it slices, it dices”…and of course who can forget “but wait there’s more!” I have been working on some Enterprise application integration projects recently.  We are using the Spring Integration framework to accomplish our work.  This project within the Spring Framework portfolio amazes me.  It reminds me of the Veg-O-Matic.  It… Read More

Spring Framework’s WebDataBinder

Last week, I was just outside our nation’s capital teaching Spring Web MVC Framework to a wonderful group of people working for the National Institute of Health (NIH).  They are getting ready to move a collection of Struts 1 projects to Spring Web MVC.  Some questions and discoveries around Spring Web MVC’s @InitBinder operations seemed a good fit for this week’s post. Spring Web MVC Command Beans Part of my Spring MVC class is dedicated to teaching students how to… Read More

How to use Spring’s WebApplicationInitializer

The DispatcherServlet has always served as the doorway component or “front controller” in a Spring Framework Web MVC application.  It’s job has been and still is to marshal requests to other components in the Spring MVC application backend and to orchestrate a response back to clients. DispatcherServlet and the web.xml Until Spring 3.1, the DispatcherServlet had to be registered with the Servlet container via the standard Web application web.xml file. The following elements had to be added to register the DispatcherServlet…. Read More

Spring 4 Generic Qualifiers

This post is part of my series on some of the new Spring 4 features. As of Spring 4, generic types can be used to determine what bean should be dependency injected (either by XML or annotation). Wiring By Generic Type An example can help clarify this new feature.  Assume you defined your DAO by generic interface (if you haven’t studied Java generic typing, you may want to visit here to learn more). Now consider a case were two beans are… Read More

Spring 4 Meta Annotations

The Spring Framework started adding annotations to Spring development with version 2.  Each release has added more annotations.  Annotations provide a powerful means to define and wire your beans, configure cross cutting concerns (like transactions) and much more.  However, given the number of annotations added to your POJO classes to provide for Spring stereotyping, dependency injection, transactions, AOP, etc., you may forget what the actual business of the class is all about.  What’s more, you have to add the same annotations to… Read More

Spring 4 – Conditional Bean Configuration

As part of my series on the new features in Spring Framework, version 4, I’d like to present how to use the new Condition interface and @Conditional annotation.  Spring 4 was just release in GA form this week.  You can check my past post for some of the highlights of this release. There are times when you would like the creation and dependency injection of a bean to depend on circumstances.  Those circumstance could be what operating system your application is… Read More

Spring 4 Ordering Autowired Collections

Spring 4 offers an array of new features.  As with all releases, some of the new features are big and impactful.  Others are tiny but helpful. Autowiring Collections One of the new small features in Spring 4 is the ability to use @Order with autowiring.  There has always been the ability to have Spring automatically collect all beans of a given type and inject them into a collection or array.  Since Spring 2.5, this was most commonly accomplished by annotation as… Read More

Spring Framework – Version 4 Due Out Tomorrow!

Happy holidays to everyone.  I hope you are enjoying this festive time of year and you get a little down time during the holidays.  If you are like me, you might enjoy using some of your down time to update yourself on the Java/open source APIs that have appeared this year.  There have been quite a few advances this year. In particular, you may want to spin up on Spring 4.  Spring Framework 4 GA (general availability) is due out tomorrow – Dec… Read More

Understanding Spring MVC Model and Session Attributes

As a Java Web application developer, you quickly learn about the request (HttpServletRequest) and session (HttpSession) scopes.  Understanding these scopes and how to work data and objects in and out of these scopes is critical to designing and building Web applications in Java.  [For a quick tutorial on request and session scopes, here is a post in StackOverflow that can help.] Spring MVC Scopes When I started writing Web applications in Spring MVC, I found the Spring model and session attributes to… Read More