Skip to content

Instantly share code, notes, and snippets.

View linusfoldemo's full-sized avatar

Linus Foldemo linusfoldemo

View GitHub Profile
@linusfoldemo
linusfoldemo / gist:8fa87969d4a54010c15f
Created February 25, 2015 07:38
Start embedded tomcat
public static void start(final Environment environment, final int port) {
Environment.set(environment);
v
final Tomcat tomcat = new Tomcat();
tomcat.setPort(port);
final File workDir = Files.createTempDir();
final Context context = tomcat.addContext("", workDir.getAbsolutePath());
context.addServletContainerInitializer(new SpringServletContainerInitializer(),
ImmutableSet.<Class<?>>of(Application.class));
@linusfoldemo
linusfoldemo / CacheInfoEndpoint
Created June 30, 2014 08:12
Configure Infinispan as Spring @Cacheable provider including Spring-boot actuator endpoint
public class CacheInfoEndpoint extends AbstractEndpoint<ObjectNode> {
public static final boolean DO_NOT_CREATE_IF_MISSING = false;
private final SpringEmbeddedCacheManager springEmbeddedCacheManager;
public CacheInfoEndpoint(final SpringEmbeddedCacheManager springEmbeddedCacheManager) {
super("cache", false, true);
this.springEmbeddedCacheManager = springEmbeddedCacheManager;
}