Josh Long

Josh Long

Josh (@starbuxman) is the Spring Developer Advocate at Pivotal and a Java Champion. He's host of "A Bootiful Podcast" (https://soundcloud.com/a-bootiful-podcast), host of the "Spring Tips Videos" (http://bit.ly/spring-tips-playlist), co-author of 6+ books (http://joshlong.com/books.html), and instructor on 8+ Livelessons Training Videos (http://joshlong.com/livelessons.html)

Recent Blog posts by Josh Long

This Week in Spring - July 10th, 2012

Engineering | July 11, 2012 | ...

Welcome back to another installment of This Week in Spring. This week, I'm at JAX in San Francisco. We're having a good time, and happily answering questions from community members. As usual, though, we've got a lot to cover, so let's get on with the show.

  1. Martin Lippert has announced the latest versions of SpringSource Tool Suite and the Groovy and Grails Tool Suites.
  2. Chris Beams has announced that Spring 3.1.2 has been released!
    	</LI>
    <LI> Rob Winch has announced that <A href = "http://www.springsource.org/node/3588">Spring Security 3.1.1 has been released!  	</A>
    </LI>
    	 
     <LI>  Costin Leau has announced that <A href = "http://www.springsource.org/node/3588">Spring GemFire 1.1.2 has been released!  	</A>
    	</LI>
    
     <LI>   The Tech Annotation page has a great post on using some of  <a href = "http://techannotation.wordpress.com/2012/07/05/remoting-spring-rmi-and-http/">Spring's remoting technologies, RMI and HTTP invoker, to expose objects  to remote clients</A>.  </LI> 
    
    
    <Li>  
    	Chris Haddad  has   put together a…

This Week in Spring - July 3rd, 2012

Engineering | July 04, 2012 | ...

Welcome back to another installment of This Week in Spring. Today, we bid farewell to the father of Spring, Rod Johnson. We wish Rod well on his next endeavors.

  1. Spring contributor and all-around-build-ninja Chris Beams put together a nice blog talking about some of the infrastructure changes in the Spring projects of late, including their moves to GitHub and to the build-tool Gradle.
  2. Martin Lippert has announced the availability of the SpringSource Tool Suites 3.0.0.M2, one for Spring and one for Groovy and Grails.
  3. Spring Data Redis 1.0.1 has been released. Among other things the new release supports support for a new (4th) Redis driver SRP, Redis native execution (RedisConnection#execute), and improved pipeline execution tracking potential errors and bulk results consistently across all drivers
    	</LI> 
    
    	<LI> 
    		Gary Russell has announced the availability of <a href ="http://www.springsource.org/node/3586">Spring Integration 2.1.3.RELEASE and  2.2.0.M3</a>. 
    		</LI>
    	
    
  4. Hubert Klein Ikkink has an interesting post on how set environment variables on Cloud Foundry.
  5. Jan Machacek announced the latest release of Specs2 Spring 0.6.1 in his blog. Check it out for more details.
  6. Matt Vickery is back with another installment on how to use Spring Integration with C24's iO products.
  7. Our friend Willie Wheeler has a great post on pageable custom queries with Spring Data JPA.
  8. Our friend Roger Hughes is back, this time with a post introducing how to get started with Spring Social.
  9. Nicolas Frankel has a nice blog introducing Spring Data JPA.
  10. The Java TV tutorial site and aggregator has both of Spring Integration contributor Oleg Zhurakousky's webinars on Spring Integration Tips 'n Tricks. It's nice when the aggregators pick up good content, but readers should also be sure to check out the source for all your SpringSource videos and tutorials, the SpringSource Dev YouTube channel.
  11. A blog, seemingly on PHP, has a post on the correct way to utilize <a href = "http://activequestionsphp.16mb.com/correct-way-to-utilize-p-and-util-namespace-in-spring-xml-configuration/">Spring's <CODE>&lt;p&gt;</CODE> and <CODE> &lt;c&gt;</CODE> namespaces. </a>
    
     </LI>
    
  12. The doanduyhai blog has an interesting post on the Spring 3.1 cache abstraction.
  13. The Learning via Code blog has a great post introducing Spring's support for message loading
  14. The JavaCode Geeks blog has an interesting post on exception handling in Spring's JSF support
  15. Only faintly related to Spring: Joram Barrez, a contributor to the Activiti BPMN2 workflow engine, to which both Spring Batch lead Dr. David Syer and I contributed the Spring support, has put up a nice post comparing the speed of the workflow engine and some of the tests use the Spring support.

This Week in Spring - June 26th, 2012

Engineering | June 27, 2012 | ...
<P> What a week! So much to talk about and scarcely enough minutes in the day to manage.   
Without any further ado, let's get on to it!	</P> 
  1. Jonathan Brisbin has announced the availability of Spring Data REST 1.0.0.RC1 . Spring Data REST helps you provide a RESTful interface for your JPA-based repositories.
  2. Oliver Gierke has announced Spring Data MongoDB 1.0.2.GA. The new release has plenty of bugfixes and improvements, so check the changelog for more.
  3. Wonder what happened to the RabbitMQ webinar that was briefly on the SpringSource events calendar? It was rescheduled (slight schedule mishap), but it's back and you should definitely mark your calendars with the updated dates. It figures to be an amazing event.
  4. Our pal Gordon Dickens - a world class trainer and engineer - has been very busy recently.
    	 If you haven't been following his blog recently, you missed an 
    	  <a href ="http://gordondickens.com/wordpress/2012/06/12/springsource_tool_suite_faq/"> introduction to the SpringSource Tool Suite  -  including its composition and value-added features,  and  answers some common questions</A>.
    		
    		 Besides the great post <a href= "http://gordondickens.com/wordpress/2012/06/12/spring-3-1-constructor-namespace">on Spring 3.1's constructor namespace…

This Week in Spring - June 19th, 2012

Engineering | June 19, 2012 | ...
<P> This week the I'm at QCon New York talking to people about Spring, Cloud Foundry,  vFabric, and  much more. Attendees at QCon conferences always keep things interesting with great questions and ideas.  
	 

As usual, though, the internet has given us a lot of great content to look at this last week, so let's dive right into the roundup!

</P> 
  1. If you missed Gary Russell's excellent webinar introducing managing and monitoring of Spring Integration applications, don't worry, the video is on the SpringSource YouTube channel.
  2.  <LI>  Details of the new  release of <a href = "http://www.springsource.org/node/3573">Spring for Apache Hadoop 1.0.0.M2</A> are available. For information on the project itself, check out this  <a href = "http://blog.springsource.org/2012/06/1…

This Week in Spring - June 12th, 2012

Engineering | June 13, 2012 | ...

Welcome back to another installment of This Week in Spring. We've got a lot to cover this week, so let's get to it!

  1. Gordon Dickens is at it again, this time with a great look at Spring 3.1's constructor namespace, which provides the logical counterpart to the p: namespace element.
  2. Matt Vickery's at it again! He's got an interesting post on how to use the C24 iO product with Spring.
  3. The Vaadin blog has an interesting post on serialization with the Vaadin web framework and Spring.
  4. The Java Code Geeks has a blog post on using the RESTEasy REST framework with Spring-based services. While I would recommend the Spring REST support in Spring MVC over this approach, it's at least interesting to have the recipe if you ever need to use it.
  5. The Java Code Geeks blog has another post on building Spring-based JPA services that sit behind a RESTful CXF backend. This is another one of those situations where, while it's useful to know how to do in case you need to, you're better off using Spring MVC's REST support. It's easier, and integrates more naturally with the component model.
  6. The Banging My Head Against a Wall blog has a great post on Upgrading from Spring 2.5 to 3.1. This blog shows that the migration is dead simple, if you haven't already made the jump, and he's got insight into one particular little gotcha you might hit to make the migration that much smoother.
  7. The TeamExtension blog has a quick post introducing how to get started with Spring Mobile 1.0. They recommend stock Eclipse with the m2e support, but of course, if you use the SpringSource Tool Suite, you won't have to set anything up.
  8. Are you a .NET developer looking for a solid dependency injection framework like Spring? Have you heard about Spring.NET, the dependency injection framework from the same people behind SpringSource? Blogger Łukasz Budnik has an interesting post about Spring.NET's superiority over other alternatives in the space (Microsoft's Unity and Ninject).

This Week in Spring, June 5th, 2012

Engineering | June 06, 2012 | ...

Welcome back to another installment of This Week in Spring. As usual, we've got a lot to look at this week so let's get to it..

  1. The video from Chris Beams's recent webinar on the various styles of dependency injection that Spring supports is up. Chris is a core Spring framework engineer (and all around good guy). This video is definitely worth a watch especially if you still think Spring configurations requires XML.
    	  </LI> 
     <LI> Oleg Zhurakousky announced the availability of 
    	 <a href = "http://www.springsource.org/node/3569">
    	 Spring Integration 2.1.2 RELEASE and 2.2.0M2</A>. The new releases are filled with many important bug fixes as well as several  
    	
    	 new features.  
    	 </LI>
    	<LI>  Roy Clarkson has announced the availability of <a href= "http://www.springsource.org/spring-android/news/1.0.0-released">Spring Android 1.0.0.RELEASE</A>! The project is an extension of the Spring Framework that aims to simplify the development of native Android applications by providing RESTTemplate support for…

This Week in Spring - May 22nd, 2012

Engineering | May 22, 2012 | ...

Welcome back to another installment of This Week in Spring. We have a lot of great content this week, as usual!

  1. Rossen Stoyanchev has put up another blog in his series on Spring MVC 3.2 Preview. This latest installment introduces a Spring MVC chat example.
  2. Oliver Gierke has announced the 1.1.0 GA version of Spring Data JPA. Spring Data JPA makes it very simple to build JPA-based repositories, saving you from the tedious boiler plate code. This new release includes new keywords for query generation (LessThanEqual, GreaterThanEqual, Before, After, StartsWith, EndsWith, and Contains), a handy PersistenceUnitPostProcessor to scan for JPA entities (to be used in Spring versions before 3.1), support for native queries in @Query, and support for declarative locking.
  3. Jonathan Brisbin announced the 1.0.0.M2 release of Spring Data REST. Spring Data REST let's you easily export your Spring repository objects as RESTful endpoints. The new release includes support for invoking query methods of Repository interfaces, support for JSR 303 and Spring Validator validations, and improved support for Spring ApplicationEvents that are emitted before and after each save or delete, and annotation-based configuration.
  4. Oleg Zhurakousky has announced the first milestone release of Spring Integration 2.2. This release includes dependency upgrades, JPA support, and support for "publisher confirms and returns," which are newly supported in Spring AMQP.
  5. Gary Russell has announced version 1.1.0 of Spring AMQP that includes support for the RabbitMQ 2.8.x client, which in turn supports mirrored queues, broker failover, publisher confirms, returns, federated exchanges, and much more.
  6. Matt Vickery has a great post introducing the Spring Integration splitter-aggregator pattern.
  7. Willie Wheeler has a great post up on his custom configuration management database (a CMDB). The post details the project, and then talks about his use of Spring Data's repositories in rebuilding the backend for CMDB. Nice post, Willie!
  8. Doug Haber put together a wonderful post on handling paging using Spring Data and the REST support in Spring 3.1.
  9. Blogger panbhatt has a detailed post on using Spring MVC's REST support to solve a particular set of problems he was having.
  10. Blogger OBSERWATORZY described his particular thought process when trying to consume a RESTful service, and wondering if Spring provided an answer (of course it did!). Read on for his resolution.
  11. Vishal Biyani has put together a nice introduction to getting started with Spring Roo and Cloud Foundry.
  12. The RabbitMQ blog has an amazing article introducing queueing theory (with an introduction to throughput, latency and bandwidth.
  13. JAXEnter has a nice roundup of some of the news releases described in this very post, including the Spring AMQP and Spring Data JPA's GAs.

This Week in Spring, May 15th, 2012

Engineering | May 16, 2012 | ...

Welcome back to another installment of This week in Spring!. We've got a lot to cover this week, as usual. So, onward!

  1. Rossen Stoyanchev has just released part two and three of his blog series introducing Spring MVC 3.2's new features. In the first installment, Rossen introduces how to make a Spring MVC @Controller asynchronous. In the second post, Rossen introduces how to add long polling to an existing web application. Long polling is useful in any number of scenarios where you want to simulate server-side push with client-side applications.
  2. <LI>  The video for <a href= "http://blog.springsource.org/author/ozhurakousky/">Oleg Zhurakousky</A>'s followup webinar introducing <a href ="http://www.springsource.org/node/3550">More Practical Tips and Tricks with Spring Integration</A> has just been posted. Check it out! </LI> 
     <LI> <A href ="http://blog.springsource.org/author/rclarkson/">Roy Clarkson</A>  just announced that <a href = "http://www.springsource.org/spring-mobile/news/1.0.0-released">Spring Mobile 1.0.0 has  been released</A>!  </LI>
    
    
    
    <LI>  SpringSource and Cloud Foundry rockstar  <a  href  ="http://blog.springsource…

Using Cloud Foundry Workers with Spring

Engineering | May 09, 2012 | ...

You've no doubt read Jennifer Hickey's amazing blog posts introducing Cloud Foundry workers, their application in setting up Ruby Resque background jobs, and today's post introducing the Spring support.

Key Takeaways for Spring Developers

  1. You need to update your version of vmc with gem update vmc.
  2. Cloud Foundry workers let you run public static void main jobs. That is, a Cloud Foundry worker is basically a process, lower level than a web application, which maps naturally to many so-called back-office jobs.
  3. You need to provide the command that Cloud Foundry will run. You could provide the java incantation you'd like it to use, but it's far simpler to ship a shell script, and have Cloud Foundry run that shell script for you, instead. The command you provide should employ $JAVA_OPTS, which Cloud Foundry has already provided to ensure consistent memory usage and JVM settings.
  4. There are various ways to automate the creation of a Cloud Foundry deployable application. If you're using Maven, then the org.codehaus.mojo:appassembler-maven-plugin plugin will help you create a startup script and package your .jars for easy deployment, as well as specifying an entry point class.
  5. Everything else is basically the same. When you do vmc push on a Java .jar project, Cloud Foundry will ask you whether the application is a standalone application. Confirm, and it'll walk you through the setup from there.

So, let's look at a few common architectures and arrangements that are easier and more natural with Cloud Foundry workers. We'll look at these patterns in terms of the Spring framework and two surrounding projects, Spring Integration and Spring Batch, both of which thrive in, and outside of, web applications. As we'll see, both of these frameworks support decoupling and improved composability. We'll disconnect what happens from when it happens, and we'll disconnect what happens from where it happens, both in the name of freeing up capacity on the front end.

I've got a Schedule to Keep!

One common question I get is: How do I do job scheduling on Cloud Foundry? Cloud Foundry supports Spring applications, and Spring of course has always supported enterprise grade scheduling abstractions like Quartz and Spring 3.0's @Scheduled annotation. @Scheduled is really nice because it is super easy to add into an existing application. In the simplest case, you add @EnableScheduling to your Java configuration or <task:annotation-driven/> to your XML, and then use the @Scheduled annotation in your code. This is a very natural thing to do in an enterprise application - perhaps you have an analytics or reporting process that needs to run? Some long running batch process? I've put together an example that demonstrates using @Scheduled to run a Spring Batch Job. The Spring Batch job itself is a worker thread that works with a web service whose poor SLA make it unfit for realtime use. It's safer, and cleaner, to handle the work in Spring Batch, where its recovery and retry capabilities pick up the slack of any network outages, network latency, etc. I'll refer you to the code example for most of the details, we'll just look at the the entry point and then look at deploying the application to Cloud Foundry.

					    
// set to every 10s for testing.
@Scheduled(fixedRate = 10 * 1000)
public void runNightlyStockPriceRecorder() throws Throwable {
	JobParameters params = new JobParametersBuilder()
		.addDate("date", new Date())
		.toJobParameters();
	JobExecution jobExecution = jobLauncher.run(job, params);
	BatchStatus batchStatus = jobExecution.getStatus();
	while (batchStatus.isRunning()) {
		logger.info("Still running...");
		Thread.sleep(1000);
	}
	logger.info(String.format("Exit status: %s", jobExecution.getExitStatus().getExitCode()));
	JobInstance jobInstance = jobExecution.getJobInstance…

This Week in Spring, May 1, 2012

Engineering | May 01, 2012 | ...

Welcome to another installment of This Week in Spring! I'm writing the back of the room during Adrian Colyer's amazing keynote at SpringOne On The Road - London event.

  1. Did you guys miss Oleg Zhurakousky's webinar, Practical Tips and Tricks with Spring Integration? Have no fear, the video is available online.

    Also, be sure to check out part 2, this Wednesday, May 3rd for both Europe and North America!

    	</LI>
    	<LI> <a href = "http://blog.springsource.org/author/rclarkson/">Roy Clarkson</A> has announced the <a href = "http://www.springsource.org/spring-mobile/news/1.0.0.rc2-released">latest release of Spring Mobile</A>.  
    		 The release has several enhancements including more refined resolution, and improved site switching behavior. 
    		
    		</LI> 
    		<LI>  <a href = "http://blog.springsource.org/author/jbrisbin/">Jonathan Brisbin</A> just announced <a href="http://blog.springsource.org/author…

Get ahead

VMware offers training and certification to turbo-charge your progress.

Learn more

Get support

Tanzu Spring offers support and binaries for OpenJDK™, Spring, and Apache Tomcat® in one simple subscription.

Learn more

Upcoming events

Check out all the upcoming events in the Spring community.

View all