Skip to content

Instantly share code, notes, and snippets.

@jpgreenwald
Created July 6, 2013 00:41
Show Gist options
  • Save jpgreenwald/5938059 to your computer and use it in GitHub Desktop.
Save jpgreenwald/5938059 to your computer and use it in GitHub Desktop.
Google Guava does not work well with Java EE 7 containers like glassfish 4. This is a producer hack to allow for deployment.
package com.swsandbox.hack;
import com.google.common.collect.ImmutableSet;
import com.google.common.util.concurrent.Service;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
/**
* This is included to bypass the Java EE 7 issue with Google Guava and CDI:
* Issue 1433: guava 14.0.1 cannot be deployed in a JEE7 Container
* https://code.google.com/p/guava-libraries/issues/detail?id=1433
*/
@ApplicationScoped
public class GuavaHack
{
@Produces
java.util.Set<Service> dummyServices()
{
return ImmutableSet.of();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment