Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LiveBeansView doesn't contain singletons registered programmatically [SPR-14199] #18773

Closed
spring-projects-issues opened this issue Apr 21, 2016 · 1 comment
Labels
status: declined type: enhancement

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Apr 21, 2016

Johnny Lim opened SPR-14199 and commented

LiveBeansView doesn't contain singletons registered programmatically.

With the following test, the second assertion is passed:

public class LiveBeansViewTests {

	@Test
	public void test() {
		AnnotationConfigApplicationContext context
				= new AnnotationConfigApplicationContext();
		context.register(TestConfiguration.class);
		context.getBeanFactory().registerSingleton("bean2", new MyBean());
		context.refresh();

		LiveBeansView view = new LiveBeansView();
		view.setApplicationContext(context);

		String json = view.getSnapshotAsJson();
		assertThat(json).contains("bean1");
		
		// FIXME: Should work with `contains()` not `doesNotContain()`.
		assertThat(json).doesNotContain("bean2");
	}
	
	@Configuration
	public static class TestConfiguration {
		
		@Bean
		public MyBean bean1() {
			return new MyBean();
		}
		
	}

	private static class MyBean {
	}
	
}

The second assertion should fail.

This was originally reported at spring-projects/spring-boot#5761


Reference URL: https://github.com/izeye/spring-boot-throwaway-branches/blob/rest-and-actuator/src/test/java/learningtest/org/springframework/context/support/LiveBeansViewTests.java

Issue Links:

  • #19051 LiveBeansView should expose FactoryBean's scope
  • #21438 LiveBeansView should support double quotes in application context id
@sbrannen
Copy link
Member

@sbrannen sbrannen commented Feb 9, 2021

Closing since LiveBeansView is now deprecated (see #25820).

@sbrannen sbrannen closed this as completed Feb 9, 2021
@sbrannen sbrannen added the status: declined label Feb 9, 2021
@sbrannen sbrannen removed this from the General Backlog milestone Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants