Deprecate LiveBeansView
This commit deprecates LiveBeansView and related classes in order to allow a future removal in order to increase the separation of concerns between Spring Framework and Spring Boot, and the consistency between JVM and native. Closes gh-25820
This commit is contained in:
parent
84b1efa4b8
commit
2dbceb9053
|
|
@ -930,6 +930,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
|
||||||
* onRefresh() method and publishing the
|
* onRefresh() method and publishing the
|
||||||
* {@link org.springframework.context.event.ContextRefreshedEvent}.
|
* {@link org.springframework.context.event.ContextRefreshedEvent}.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
protected void finishRefresh() {
|
protected void finishRefresh() {
|
||||||
// Clear context-level resource caches (such as ASM metadata from scanning).
|
// Clear context-level resource caches (such as ASM metadata from scanning).
|
||||||
clearResourceCaches();
|
clearResourceCaches();
|
||||||
|
|
@ -1047,6 +1048,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
|
||||||
* @see #close()
|
* @see #close()
|
||||||
* @see #registerShutdownHook()
|
* @see #registerShutdownHook()
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
protected void doClose() {
|
protected void doClose() {
|
||||||
// Check whether an actual close attempt is necessary...
|
// Check whether an actual close attempt is necessary...
|
||||||
if (this.active.get() && this.closed.compareAndSet(false, true)) {
|
if (this.active.get() && this.closed.compareAndSet(false, true)) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -42,15 +42,14 @@ import org.springframework.util.StringUtils;
|
||||||
* local {@code LiveBeansView} bean definition) or all registered ApplicationContexts
|
* local {@code LiveBeansView} bean definition) or all registered ApplicationContexts
|
||||||
* (driven by the {@value #MBEAN_DOMAIN_PROPERTY_NAME} environment property).
|
* (driven by the {@value #MBEAN_DOMAIN_PROPERTY_NAME} environment property).
|
||||||
*
|
*
|
||||||
* <p>Note: This feature is still in beta and primarily designed for use with
|
|
||||||
* Spring Tool Suite 3.1 and higher.
|
|
||||||
*
|
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
* @since 3.2
|
* @since 3.2
|
||||||
* @see #getSnapshotAsJson()
|
* @see #getSnapshotAsJson()
|
||||||
* @see org.springframework.web.context.support.LiveBeansViewServlet
|
* @see org.springframework.web.context.support.LiveBeansViewServlet
|
||||||
|
* @deprecated as of 5.3, in favor of using Spring Boot actuators for such need.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public class LiveBeansView implements LiveBeansViewMBean, ApplicationContextAware {
|
public class LiveBeansView implements LiveBeansViewMBean, ApplicationContextAware {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -21,7 +21,9 @@ package org.springframework.context.support;
|
||||||
*
|
*
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
* @since 3.2
|
* @since 3.2
|
||||||
|
* @deprecated as of 5.3, in favor of using Spring Boot actuators for such need.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public interface LiveBeansViewMBean {
|
public interface LiveBeansViewMBean {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -23,12 +23,11 @@ import javax.servlet.http.HttpServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.springframework.context.support.LiveBeansView;
|
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Servlet variant of {@link LiveBeansView}'s MBean exposure.
|
* Servlet variant of {@link org.springframework.context.support.LiveBeansView}'s MBean exposure.
|
||||||
*
|
*
|
||||||
* <p>Generates a JSON snapshot for current beans and their dependencies in
|
* <p>Generates a JSON snapshot for current beans and their dependencies in
|
||||||
* all ApplicationContexts that live within the current web application.
|
* all ApplicationContexts that live within the current web application.
|
||||||
|
|
@ -36,12 +35,14 @@ import org.springframework.util.Assert;
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
* @since 3.2
|
* @since 3.2
|
||||||
* @see org.springframework.context.support.LiveBeansView#getSnapshotAsJson()
|
* @see org.springframework.context.support.LiveBeansView#getSnapshotAsJson()
|
||||||
|
* @deprecated as of 5.3, in favor of using Spring Boot actuators for such need.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class LiveBeansViewServlet extends HttpServlet {
|
public class LiveBeansViewServlet extends HttpServlet {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private LiveBeansView liveBeansView;
|
private org.springframework.context.support.LiveBeansView liveBeansView;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -49,7 +50,7 @@ public class LiveBeansViewServlet extends HttpServlet {
|
||||||
this.liveBeansView = buildLiveBeansView();
|
this.liveBeansView = buildLiveBeansView();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected LiveBeansView buildLiveBeansView() {
|
protected org.springframework.context.support.LiveBeansView buildLiveBeansView() {
|
||||||
return new ServletContextLiveBeansView(getServletContext());
|
return new ServletContextLiveBeansView(getServletContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,17 +23,18 @@ import java.util.Set;
|
||||||
import javax.servlet.ServletContext;
|
import javax.servlet.ServletContext;
|
||||||
|
|
||||||
import org.springframework.context.ConfigurableApplicationContext;
|
import org.springframework.context.ConfigurableApplicationContext;
|
||||||
import org.springframework.context.support.LiveBeansView;
|
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link LiveBeansView} subclass which looks for all ApplicationContexts
|
* {@link org.springframework.context.support.LiveBeansView} subclass which looks for all ApplicationContexts
|
||||||
* in the web application, as exposed in ServletContext attributes.
|
* in the web application, as exposed in ServletContext attributes.
|
||||||
*
|
*
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
* @since 3.2
|
* @since 3.2
|
||||||
|
* @deprecated as of 5.3, in favor of using Spring Boot actuators for such need.
|
||||||
*/
|
*/
|
||||||
public class ServletContextLiveBeansView extends LiveBeansView {
|
@Deprecated
|
||||||
|
public class ServletContextLiveBeansView extends org.springframework.context.support.LiveBeansView {
|
||||||
|
|
||||||
private final ServletContext servletContext;
|
private final ServletContext servletContext;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue