Introduced beta version of LiveBeansView for STS 3.1

LiveBeansView includes MBean exposure as well as Servlet exposure, with JSON as the initial output format. In order to identify an MBean per application, a new "getApplicationName()" method got introduced on the ApplicationContext interface, returning the Servlet container context path in case of a web application and defaulting to the empty String. MBean exposure can be driven by the "spring.liveBeansView.mbeanDomain" property, e.g. specifying "liveBeansView" as its value, leading to "liveBeansView:application=" or "liveBeansView:application=/myapp" style names for the per-application MBean.

Issue: SPR-9662
This commit is contained in:
Juergen Hoeller
2012-09-24 23:15:58 +02:00
parent 53ae345a88
commit e5f3669804
9 changed files with 402 additions and 18 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -143,6 +143,22 @@ public abstract class AbstractRefreshablePortletApplicationContext extends Abstr
return super.getConfigLocations();
}
@Override
public String getApplicationName() {
if (this.portletContext == null) {
return "";
}
String name = this.portletContext.getPortletContextName();
return (name != null ? name : "");
}
/**
* Create and return a new {@link StandardPortletEnvironment}.
*/
@Override
protected ConfigurableEnvironment createEnvironment() {
return new StandardPortletEnvironment();
}
/**
* Register request/session scopes, a {@link PortletContextAwareProcessor}, etc.
@@ -160,14 +176,6 @@ public abstract class AbstractRefreshablePortletApplicationContext extends Abstr
beanFactory, this.servletContext, this.portletContext, this.portletConfig);
}
/**
* Create and return a new {@link StandardPortletEnvironment}.
*/
@Override
protected ConfigurableEnvironment createEnvironment() {
return new StandardPortletEnvironment();
}
/**
* This implementation supports file paths beneath the root of the PortletContext.
* @see PortletContextResource
@@ -190,4 +198,5 @@ public abstract class AbstractRefreshablePortletApplicationContext extends Abstr
protected void customizeBeanFactory(DefaultListableBeanFactory beanFactory) {
super.customizeBeanFactory(beanFactory);
}
}