Java Code Examples for org.springframework.context.ConfigurableApplicationContext#getApplicationName()

The following examples show how to use org.springframework.context.ConfigurableApplicationContext#getApplicationName() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: spring-analysis-note   File: LiveBeansView.java    License: MIT License 6 votes vote down vote up
static void registerApplicationContext(ConfigurableApplicationContext applicationContext) {
	String mbeanDomain = applicationContext.getEnvironment().getProperty(MBEAN_DOMAIN_PROPERTY_NAME);
	if (mbeanDomain != null) {
		synchronized (applicationContexts) {
			if (applicationContexts.isEmpty()) {
				try {
					MBeanServer server = ManagementFactory.getPlatformMBeanServer();
					applicationName = applicationContext.getApplicationName();
					server.registerMBean(new LiveBeansView(),
							new ObjectName(mbeanDomain, MBEAN_APPLICATION_KEY, applicationName));
				}
				catch (Throwable ex) {
					throw new ApplicationContextException("Failed to register LiveBeansView MBean", ex);
				}
			}
			applicationContexts.add(applicationContext);
		}
	}
}
 
Example 2
Source Project: java-technology-stack   File: LiveBeansView.java    License: MIT License 6 votes vote down vote up
static void registerApplicationContext(ConfigurableApplicationContext applicationContext) {
	String mbeanDomain = applicationContext.getEnvironment().getProperty(MBEAN_DOMAIN_PROPERTY_NAME);
	if (mbeanDomain != null) {
		synchronized (applicationContexts) {
			if (applicationContexts.isEmpty()) {
				try {
					MBeanServer server = ManagementFactory.getPlatformMBeanServer();
					applicationName = applicationContext.getApplicationName();
					server.registerMBean(new LiveBeansView(),
							new ObjectName(mbeanDomain, MBEAN_APPLICATION_KEY, applicationName));
				}
				catch (Throwable ex) {
					throw new ApplicationContextException("Failed to register LiveBeansView MBean", ex);
				}
			}
			applicationContexts.add(applicationContext);
		}
	}
}
 
Example 3
Source Project: lams   File: LiveBeansView.java    License: GNU General Public License v2.0 6 votes vote down vote up
static void registerApplicationContext(ConfigurableApplicationContext applicationContext) {
	String mbeanDomain = applicationContext.getEnvironment().getProperty(MBEAN_DOMAIN_PROPERTY_NAME);
	if (mbeanDomain != null) {
		synchronized (applicationContexts) {
			if (applicationContexts.isEmpty()) {
				try {
					MBeanServer server = ManagementFactory.getPlatformMBeanServer();
					applicationName = applicationContext.getApplicationName();
					server.registerMBean(new LiveBeansView(),
							new ObjectName(mbeanDomain, MBEAN_APPLICATION_KEY, applicationName));
				}
				catch (Throwable ex) {
					throw new ApplicationContextException("Failed to register LiveBeansView MBean", ex);
				}
			}
			applicationContexts.add(applicationContext);
		}
	}
}