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:
Sébastien Deleuze 2020-09-25 19:59:56 +02:00
parent 84b1efa4b8
commit 2dbceb9053
5 changed files with 18 additions and 13 deletions

View File

@ -930,6 +930,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
* onRefresh() method and publishing the
* {@link org.springframework.context.event.ContextRefreshedEvent}.
*/
@SuppressWarnings("deprecation")
protected void finishRefresh() {
// Clear context-level resource caches (such as ASM metadata from scanning).
clearResourceCaches();
@ -1047,6 +1048,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
* @see #close()
* @see #registerShutdownHook()
*/
@SuppressWarnings("deprecation")
protected void doClose() {
// Check whether an actual close attempt is necessary...
if (this.active.get() && this.closed.compareAndSet(false, true)) {

View File

@ -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");
* 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
* (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 Stephane Nicoll
* @since 3.2
* @see #getSnapshotAsJson()
* @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 {
/**

View File

@ -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");
* you may not use this file except in compliance with the License.
@ -21,7 +21,9 @@ package org.springframework.context.support;
*
* @author Juergen Hoeller
* @since 3.2
* @deprecated as of 5.3, in favor of using Spring Boot actuators for such need.
*/
@Deprecated
public interface LiveBeansViewMBean {
/**

View File

@ -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");
* 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.HttpServletResponse;
import org.springframework.context.support.LiveBeansView;
import org.springframework.lang.Nullable;
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
* all ApplicationContexts that live within the current web application.
@ -36,12 +35,14 @@ import org.springframework.util.Assert;
* @author Juergen Hoeller
* @since 3.2
* @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")
public class LiveBeansViewServlet extends HttpServlet {
@Nullable
private LiveBeansView liveBeansView;
private org.springframework.context.support.LiveBeansView liveBeansView;
@Override
@ -49,7 +50,7 @@ public class LiveBeansViewServlet extends HttpServlet {
this.liveBeansView = buildLiveBeansView();
}
protected LiveBeansView buildLiveBeansView() {
protected org.springframework.context.support.LiveBeansView buildLiveBeansView() {
return new ServletContextLiveBeansView(getServletContext());
}

View File

@ -23,17 +23,18 @@ import java.util.Set;
import javax.servlet.ServletContext;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.LiveBeansView;
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.
*
* @author Juergen Hoeller
* @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;