Mar
28
2005
0

Spring Framework 1.2RC1 released

An interesting amount of new features has been added to Spring 1.2, of which I personally find JMX and the Hibernate3 support the most interesting ones. The first RC has just been released. Have a look at www.springframework.org and give it a try!

– As posted by Juergen on the mailing list:

Dear Spring community,

It’s Spring time :-)

I’m pleased to announce that Spring 1.2 RC1 has just been released. This
release introduces a number of major new features:

  • finer-grained distribution jar files, alongside the full spring.jar
  • AOP Alliance interfaces are now contained in spring-aop.jar and spring.jar
  • XML bean definition improvements (”ref” and “value” shortcut attributes etc)
  • improved AOP TargetSourceCreator mechanism (supporting LazyInitTargetSource too)
  • transaction annotation support for JDK 1.5+ (annotation called “Transactional”)
  • improved WebLogicJtaTransactionManager (transaction names, isolation levels)
  • SqlRowSet support for JDBC (in conjunction with JdbcTemplate’s “queryForRowSet”)
  • Hibernate3 support (in orm.hibernate3; Hibernate 2.1 support is still available)
  • JMX support for export of Spring beans as managed resources and for MBean access
  • Commons Attributes and JDK 1.5+ annotations for JMX MBean export

This release also contains many minor enhancements, for example:

  • factored out BindingErrorProcessor strategy for ServletRequestDataBinder
  • improved ParameterMethodNameResolver for Web MVC MultiActionController

For a detailed list of enhancements and bug fixes, see the changelog.

This release candidate is already considered stable and recommended for development use. We expect Spring 1.2 final to be released in late April.

Watch out for the Spring Web Flow preview release to follow later this week (for use with Spring 1.2)! Web Flow will also become part of the nightly build at that time.

Cheers,

Juergen

—–
Juergen Hoeller
Interface21 – Spring Services from the Source
http://www.springframework.com

Written by Alef in: Java-related, Spring |
Mar
27
2005
0

JTeam zoekt mensen!

Even iets anders:

Wil je een uitdagende baan bij een innovatief bedrijf wat met de laatste technieken bezig is? Is programmeren je passie en ben je communicatief genoeg om eventueel ook bij klanten te gaan vertellen hoe het echt moet? Lees verder, kijk of het volgende profiel bij je past en reageer. Want JTeam zoekt

Enthousiaste J2EE programmeurs

Als programmeur bij JTeam houd je je bezig met het implementeren van (delen van) projecten, veelal uitgevoerd in eXtreme Programming fashion. We maken gebruik van moderne technieken waarmee we altijd zorgen dat de klant krijgt wat hij wil. Je werkt aan meerdere projecten tegelijkertijd. Deze projecten zijn soms groot, soms ook wat kleiner. Voorbeelden: een systeem voor het administreren van electronische-patienten-dossiers, een zoekmachine (ilse.nl), een offerte-management-systeem.

JTeam focust zich op het gebruik van open source software binnen haar projecten en vindt het belangrijk dat er door haar mensen bijdragen geleverd worden aan open source initiatieven. Zo dragen JTeam medewerkers bij aan het Spring Framework, XFire en NEO.

Je bent bekend met de volgende methoden & technieken

  • Spring Framework
  • Hibernate en/of JDO
  • Struts en/of WebWork
  • J2EE in het algemeen
  • Tomcat en/of WebLogic
  • eXtreme Programming
  • IntelliJ IDEA en/of Eclipse
  • CruiseControl / Ant / CVS / JIRA

Voor de rest

  • Wil je werken in een omgeving waar gewerkt wordt met de laatste technologie
  • Ben je stress-bestendig
  • Wil je bij de top horen
  • Heb je je rijbewijs

Voel je je aangesproken? Stuur een email met je CV naar info@jteam.nl.Vergeet niet te melden waarom je bij graag bij JTeam wil werken!

P.S. we zijn op zoek naar mensen van alle niveaus. Ook stagiaires worden aangemoedigd om te solliciteren!

Written by Alef in: Other |
Mar
20
2005
0

A feel-good story about Spring :)

I had a developer at a client of ours (quite a large multinational) proof read some of the material for the upcoming Spring book. I introduced Spring there a couple of months ago and seems to do its job okay at quite some levels. I started introducing Spring on an internal tool used by both the development department and the departments responsible for operations and maintenance of several systems. I used Spring MVC in combination with SiteMesh and the remoting facilities Spring offers to create a pluggable web application that allows for the deployment of small pieces of functionality. (Of course :) ) that proved to be quite easy.

More recently we also started to use some of the other Spring functionality. Traditionally, the company has a big investment in the database layer. Loads of stored procedures, triggers, views, etcetera. That’s probably not going to go away anytime soon. I also don’t really see that as a big problem. They really have a lot of database knowledge there and I’ve always been kind of the ‘right-tool-for-the-job’-person anyway. I had some of the guys have a peek at the book chapter regarding Spring JDBC (proof reading that is, but of course they also benefited quite a bit). I got some really good comments.

It’s really good to see how they’re starting to replace their proprietary JDBC frameworks with Spring JDBC and getting rid of practices that have been around for a long time (try/catch blocks all over the place, custom resource management and connection pools, custom transaction management or no transaction management at all). Also I was really amazed by the immediate creativity of some of the people. During a migration of a lot of data they immediately created this small main application, loading a Spring ApplicationContext with a transaction manager, datasource and a couple of custom DAOs. Fully unit-tested, it offered a really convenient way of doing such a migration.

Again, Spring made my day (and that of the client).

p.s. sorry about the positive rant, sometimes I just feel like shouting out loud that I like Spring :)

Written by Alef in: Java-related, Spring |
Mar
17
2005
1

Ajax in Action (part II)

For those of you who didn’t notice it, my last post about an upcoming book on Ajax was meant to be a joke. Maybe it was because of the cover (Bram’s PhotoShop skills come in handy sometimes), maybe it was because I didn’t put in enough smileys, I don’t know.

Anyway, Bram and I were kind of bored with all those Ajax-related blog posts popping up on all the aggregators (not that we think it’s useless, on the contrary) and wanted to join the club :) , that’s all…

So… no book on Ajax written by Bram and me.

p.s. I guess you’ve all seen Effective Enterprise HashMap??

Written by Alef in: Java-related |
Mar
16
2005
16

Ajax in Action: Coming Soon!

Ever since the XmlHttpRequest was introduced (Mozilla 1.0, IE5) we imagined writing a book about it. Unfortunately, the publishers we contacted had never this bit of intriguing functionality that makes web applications about a 1000 times more dynamic and oh so attractive :) . They didn’t think it would be a big success.

However, thanks to several people where I’d like to name Dion in particular, we were able to get a really good deal just a week ago. We’ll be starting to write the book pretty soon! This is the cover:

;-)

Written by Alef in: Java-related |
Mar
12
2005
1

Spring MultipleCommandController revisited

Colin pointed out that there is a simpler approach to supporting multiple command in a Spring command controller. I blogged about this some time ago but somehow completely forgot that I could have modeled the wrapping class as an inner class. This makes the whole thing much cleaner:

public XXXXX extends AbstractFormController {
 
  . . .
 
  public static class Command {
    MyDomainObject myDomainObject = 
      new MyDomainObject();
    MyOtherObject myOtherObject = 
      new MyOtherObject();
 
    public MyDomainObject getMyDomainObject() { 
      return myDomainObject;
    }
    public MyOtherObject getMyOtherObject() { 
      return myOtherObject;
    }
  }
}

The controller and the JSP are the only ones that need knowledge of the wrapping object and afterall, coding an inner class is pretty much 2 seconds of extra work.

Written by Alef in: Java-related, Spring |
Mar
12
2005
34

Configuration management with Spring

For every project we have a staging environment that is almost always pretty much identical to the production environment. Of course you can’t completely mimick the production environment since systems we’re integrating with are not available (in which case they’re mocked) or located in a different place. We’re doing a lot Spring-based apps and some of the features Spring offers are really useful when distinguishing between a local environment, a staging environment and the final production environment. The following discusses the possibilities you have for setting up a Spring ApplicationContext to be able to deploy it to different environments without having to change the context itself.

PropertyPlaceHolderConfigurer

Spring offers two beans that allow you to externalize some of the properties in an ApplicationContext. The first and most often used one is the PropertyPlaceholderConfigurer. This bean allows you to include ${xxxyyyzzz} tokens in your application context and have them resolved at run-time (when the application context is loaded) from an external Properties file for example. An example would be the following:

<bean id='salesForceConnection' 
    class='icatch.salesforce.SalesForceConnectionImpl'
    singleton='false' 
    init-method='init' destroy-method='close'>
  <property name='url'>
    <value>${salesforce.url}</value>
  </property>
</bean>

The connection to the Salesforce service we’re integrating with is not mentioned in the context itself. Instead we are going to provide a separate Properties file and include it there. When deploying the application on the staging environment, we do not want to connect to the live Salesforce environment, but to the development edition instead. This offers the same features so we can still test everything. So based on the environment, we’re placing a different properties file in a pre-defined location and the application itself doesn’t need to change.

# staging.properties
salesforce.url=\
  https://na1-api.salesforce.com/services/Soap/c/3.0
 
#live.properties
salesforce.url=\
  https://emea.salesforce.com/services/Soap/c/2.5

Of course we still have to tell Spring where to find the properties it needs use when replacing the tokens. This is where the so-called BeanFactoryPostProcessor comes in. A post-processor is automatically executed after a context has fully finished loading all its bean definitions. This doesn’t mean any beans have been instantiated yet! The post-processor is allowed to inspect the application context and make changes as he wishes. One of those post-processor is the PropertyPlaceholderConfigurer. Configure it using the code snippet below. As you can see, we’ve put a Properties file in a pre-defined location and give it to the Spring placeholder configurer using the location property.

<bean class='org.spr....config.PropertyPlaceholderConfigurer'>
  <propert name='location'>
    <value>/etc/icatch/sfconnection.properties</value>
  
</propert></bean>

PropertyOverrideConfigurer

The example above shows an ApplicationContext with tokens that are replaced at run-time. Another option is to have default values in your context and have a PropertyOverrideConfigurer override those. This way you don’t always have to mention a configurer in your context and provide default values for development purposes. This would look something like the following:

<bean id='salesForceConnection'
    class='icatch.salesforce.SalesForceConnectionImpl'
    singleton='false' 
    init-method='init' destroy-method='close'>
  <property name='url'>
    <value>${salesforce.url}</value>
  </property>
  <property name='username'>
    <value>blabbering</value>
  </property>
  <property name='password'>
    <value>blabbering</value>
  </property>
  <property name='sessionTimeoutMS'>
    <value>5400000</value> <!-- 1,5 hour -->
  </property>
</bean>
#live-override.properties
salesForceConnection.username=realusername
salesForceConnection.password=realpassword

Choosing beans using a configurer

(overriding bean references)

One other nifty thing you can do using placeholder and override configurers is referencing a different bean based on a properties file. This feature is not really documented anywhere but can be handy sometimes. The configurers as they exist now only override and replace property values. In other words, they’re not capable of overriding and replacing complete bean definitions. The configurers are however able to override and replace bean references. This can be quite handy when you have more complex requirements and cannot do with simply replacing a property value:

<beans>
  <bean class='org.spr....config.PropertyPlaceholderConfigurer'>
    <property name='properties'>
      <props>
        <prop key='connection.name'>connectionOne</prop>
      </props>
    </property>
  </bean>
 
  <bean id='service' class='ServiceObject'>
    <property name='salesForceConnection'>
      <ref bean='${connection.name}'/>
    </property>
  </bean>
 
  <bean id='connectionOne' class='SuperConnection'>
    <!-- other properties -->
  </bean>
 
  <bean id='connectionTwo' class='NotSoSuperConnection'>
    <!-- other properties -->
  </bean>
 
</beans>

Remember, usually one would split such a context in three files: one containing connectionTwo, one containing connectionOne and the other containing the service object. Based on what environment you’re in you would load a certain combinations of contexts. This is the way to go forward when selecting a data source implementation but the drawback here is that you need to override the bean itself. You cannot override the bean reference here. Using a PropertyPlaceholderConfigurer or PropertyOverrideConfigurer you can do that.

The location of your properties files

Then there is of course the issue of how to manage the different configurations. We usually have a configuration module in CVS where we keep directories for all different environments (one for staging, one for testing, one for production). Deploying a new version mean we have do the following:

  • Deploy the new war file
  • Overwrite the configuration directory with the directory we’ve pulled from CVS, specific to the current environment

So in case of the above examples, we’d have the following directory structure:

   +-- staging
           - placeholder.properties
           - override.properties
   +-- production
           - placeholder.properties
           - override.properties
Written by Alef in: Java-related, Spring |
Mar
11
2005
3

Ant vs Maven and dependency management

It seems there is a lot going on about dependency management and building (Java) software lately. Is it just me or is this something we need to resolve at a different level. Certainly Ivy is pretty cool, as Colin mentioned and after I had a look at it I certainly found it better than Maven’s dependency management features. The fact that it’s capable of resolving transitive dependencies is something we’ve been looking for for ages already.

But then again, is a good dependency management tool and a decent amount of Ant scripts going to do the job. I suspect not. My question is: we’ve been doing this stuff for sooo long now already (when did Ant first arrive, was it 2000, I can’t even remember) why has NOBODY ever figured out how things should really work, from a developer’s point of view as well as from a release management point of view and a customer’s point of view. Arjen told me (after he visited the .NET developer days in Holland last week) the new Visual Studio Enterprise Edition (Arjen, maybe you can elaborate here??) includes a continuous integration tool, the ability to configure workflow before a commit happens (no comitting of code before all tests are run) and much more stuff like.

From a developer’s point of view I’d like the following:

  1. Being able to import my project in any IDE (Eclipse or IDEA that is) without any custom stuff (so please, no maven idea)
  2. Develop code and run tests in my IDE
  3. Create and deploy one or more artifacts to one or more environments
  4. Run integration tests in my IDEA (ooops slip of the …)

From a release management perspective I’d like to see the following:

  1. Have a continuous build that
    • reports on any errors, glitches and out-of-the-ordinary situations
    • generates artifacts and deploys them to some environment
    • runs all tests
    • creates a release of the software specific to the environment I’m using
    • sends an email to all involved in this successful or failing build
  2. Have the ability to download a successful build and deploy it on any environment (staging, production)
  3. Being able to identify a successful build as being the final result of an iteration (a version)
  4. Being able to roll back to any previous release

Well, is that all? That shouldn’t be too hard should it :) ? Well, at the moment Maven doesn’t take the right approach (as far as I’m concerned) and Ant is too fine-grained to make things usable at a higher level. All it leaves us is the option to have a common build library with all kinds of Ant scripts that we can import from a pre-defined location (as of 1.6). No overriding, no extending, no etcetera.

A couple of interesting other articles / posts:

Written by Alef in: Java-related |
Mar
03
2005
4

Spring FormController with multiple commands

WebWork ValueStack – ideas for Spring to support multiple commands

I was attending the WebWork 2 session at TSSJS today by Patrick and Jason. I’m quite familiar with WebWork so the content of the session wasn’t really new to me. I did however start to think about supporting multiple command objects in a Spring FormController during the session. The idea of a ValueStack WebWork usess is pretty cool and the way they recursively search through the value stack to retrieve a specific property expressed in OGNL is interesting.

I wonder if we could do something like that in Spring’s FormController or at least get to a point where multiple commands in a single form are supported. Right now one approach to editing multiple objects to wrap the commands in a separate JavaBean and use that in you expressions. This way, retrieval as well as binding works, but you have to create yourself a wrapper, which is kind of ugly.

I think I’d have to create a new command controller something like a MultipleCommandController. I’ll have a go at it and see what I can come up with. Input, comments or ideas would be nice :) .

Written by Alef in: Java-related |
Mar
01
2005
3

Spring WebFlow

Keith Donald posted on Spring WebFlow which has been developed in the Spring sandbox lately. Originall, WebFlow was developed by Erwin Vervaet and has been added to Spring lately. I still haven’t found the time to look at this but I’ve got it planned for next week :) .

More info can be found on the Spring Framework Wiki: http://opensource.atlassian.com/confluence/spring/display/WEBFLOW/Home.

Written by Alef in: Java-related |

Powered by WordPress | Theme: Aeros 2.0 by TheBuckmaker.com