Thursday, 11 December 2014

Spring Advanced: Remoting and Webservices now Available!

It's been far too long since my last post - I've been so busy recording the next course!

At last, it's now available from Virtual Pair Programmers

Originally I planned a single "Spring Advanced" course: I found this is impossible as there is so much to cover. Remoting on its own easily filled 20 hours of video training!

I know our customers are very keen on Spring Security so that will be the next module, I'll be starting work on that in January.

I think most will be interested in the REST section, so I made sure that's the biggest part of the course.

  • The running order is: 
  • Introduction Part 1: Traditional Remoting - Overview 
  • RMI on the Client 
  • Alternatives to RMI - Hessian, Burlap and HttpInvoker 
  • RMI Practical 
  • Part 2: SOAP Webservices 
  • Spring and SOAP 
  • Spring SOAP Clients 
  • Deploying SOAP to Tomcat 
  • Introducing Spring-WS 
  • Spring-WS and JAXB 
  • More Spring-WS 
  • SOAP Practical 
  • Part 3: REST Warmup 
  • Introducing REST 
  • Representations and URIs 
  • Content Negotiation 
  • Error Handling 
  • Client Side Errors 
  • Collections and Ranges 
  • Full HTTP Operations 
  • Editing Conflicts (optional) 
  • Partial Updates with PATCH (optional) 
  • More HATEOAS 
  • Validation 
  • Practical Session 
  • Course Summary 

As always, you'll be programming all the way through, and full code is provided. It's a big course, even so I didn't have room for three further topics, so the following will all be covered here on the blog starting next month:

  • The HTTP OPTIONS Verb 
  • Creating your own HttpMessageCoverter (we'll be doing a YAML content-type) 
  • Spring-Data REST (this is for CRUD applications so I didn't feel it fit with the tone of the course. But it could be useful to some).

I hope you'll enjoy the course, stay tuned for these extra topics.

Monday, 23 June 2014

New CDI Material on JavaEE course

We've now added three new chapters covering CDI to the JavaEE course - a preview of the first chapter and the full story below!

When we recorded the JavaEE course, we wanted to cover all of the fundamental topics that every practicing JavaEE developer should know.

The course is still relevant for JavaEE 7 (although upgrading Glassfish can be a pain), but it's become clear that we did miss one topic that should be in there: CDI.

CDI is a replacement to what I call the "classic" dependency injection features that were added back in JavaEE 5. The classic DI is a bit weak - for example you are limited in the types of objects that are allowed to be injected.

CDI changes that and adds a much more flexible DI framework into JavaEE. It's very similar to Spring's Dependency Injection (if you're using annotations), or Google's Guice.

CDI was available when we recorded the course, but it was new and we didn't know if it would be used by real projects. Today it's clear that it is, so its important that we have it on the course.

We've now added 3 chapters to the course, and if you've already bought it, you get these chapters for free - just log on to your account as normal, and you will find the three chapters, with some additional code, at the bottom of the chapters list.

If you bought the course on DVD from a retailer, just send us a support call with your proof of purchase and we will set up an online account for you to download the chapters.

Friday, 7 March 2014

Decent settings for DBCP Connection Pools

The Spring Framework course from 2009 is the first course that we've re-recorded at VirtualPairProgrammers. Although surprisingly little has changed in Spring since then, we felt it was time to polish the course up a little, to use the latest Spring 4, and in particular to use a more modern format for the video - with the second edition you'll be able to view it on iPads and mobile devices, as with most of our other courses.

Note: everyone who bought the first edition of the course will automatically receive the second edition on the day of release - currently slated for around the 14 March 2014, but there may be delays as we complete the editing process.

I have actually made very few changes from the original. One area that I felt worthy of update was in our choice of connection pool. In the first edition we used the Apache DBCP connection pool, largely because it was the pool of choice at that time for the reference manual.

Since then, it's fair to say that DBCP has come in for a lot of criticism, and other pools such as C3PO, Proxool or the Tomcat pool have become more popular.

There's a great debate about this at StackOverflow (see here: - a shame they closed the question as "not constructive" because it most certainly was constructive).

In the end, however, I decided to continue using DBCP for the second edition, partly to keep consistency with the old course, but also because actually DBCP isn't that bad - we've used it successfully on several large scale projects with high traffic.

I think the biggest problem with DBCP is that the defaults are so poor. If you configure DBCP with just a driver, url, user and pass, then you're going to end up with a  pool that soon locks up.

On the re-recorded version I alert the viewers to this, and tell you that you really need to tweak the pool to bring it to a performant level. But there isn't time on the course to get bogged down in this, so I pointed the viewers to this blog post, where some more sensible values can be found.

Our default settings are:

  • maxActive = 150
  • maxIdle = 10
  • minIdle = 5
  • initialSize = 5
  • minEvictableIdleTimeMillis = 1800000
  • timeBetweenEvictionRunsMillis = 1800000
  • maxWait = 10000
  • validationQuery = "SELECT 1"
  • testOnBorrow=true
  • testOnReturn=true
  • testWhileIdle=true

And you set each of these properties in the Spring XML in the same way you set the driver etc. Eg <property name="maxActive" value="150"/>

I'm not saying these values are good for any application - you need to test, tweak and tune, but at VPP we use these settings as a starting point, and they are in fact the exact settings we currently have on our live site. Our live site isn't exactly high traffic in the Facebook/Google sense, but we do get heavy traffic when we release a new course, so these settings should be reasonably good for most average websites.

Having said that, you can also switch to other pools quite easily, but I wanted to capture these defaults somewhere.

Friday, 14 February 2014

New "Spring Advanced" course on the way

I'm now starting work on a course that I promised ages ago, but other things got in the way (JavaEE, JMS, Hibernate, etc, etc!)

This is going to be a course that goes beyond the fundamentals of Spring and goes into detail on some of the more advanced uses of Spring.

I'm still marking out the outline and working on the scripts, but at the moment the ideas are:
  • Spring Security (both for standalone and MVC applications)
  • Spring Remoting - RMI, Hessian, Burlap and HttpInvoker
  • SOAP Webservices in Spring (including contract first with Spring-WS)
  • REST (possibly including Spring-HATEOAS)
  • Spring Messaging (withApache ActiveMQ)
  • Java Management Extensions - JMX
  • JavaEE Services - Scheduling with Quartz and Email
  • Spring Data (hopefully covering MongoDB and Neo4j, maybe even Hadoop)
Spring Data is the chapter I'm most excited about as it will give us our first "toe in the water" with Big Data and NoSQL.

There is a possibility I might cover bigger topics such as Spring Batch, Spring Integration, Spring DM or Spring Roo but I'm not going to promise any of these just yet as each of them could fill an entire course. Certainly I won't be doing them all!

Recording will begin shortly, as usual it will take twice as long as I expect so I won't give a release date just yet. However, before then there will be a minor update to the existing Spring Fundamentals course to bring it up to date with Spring 4. This will be released early March and will be a free upgrade to everyone who has already bought that course. It will be a very minor upgrade as the changes between versions 2/3/4 are extremely slight (in terms of the fundamentals).

Progress updates to follow!