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

Spring plugin registers a managed bean for a prototype bean #241

Closed
Artur- opened this issue May 4, 2018 · 2 comments
Closed

Spring plugin registers a managed bean for a prototype bean #241

Artur- opened this issue May 4, 2018 · 2 comments
Assignees
Labels

Comments

@Artur-
Copy link
Contributor

Artur- commented May 4, 2018

If you have a Spring Boot app

@SpringBootApplication
public class ExampleServletInitializer extends SpringBootServletInitializer {

	public static void main(String[] args) {
		ConfigurableApplicationContext app = SpringApplication.run(ExampleServletInitializer.class, args);
		Test test = app.getAutowireCapableBeanFactory().createBean(Test.class);
		System.out.println(app.getBeanNamesForType(Test.class).length);
	}
}

and a class in the same package

public class Test {
}

Then on startup:

System.out.println(app.getBeanNamesForType(Test.class).length);

prints

0

However, if you add a method to the Test class, log shows

HOTSWAP AGENT: 10:49:52.401 RELOAD (org.hotswap.agent.plugin.spring.scanner.ClassPathBeanDefinitionScannerAgent) - Registering Spring bean 'test'
HOTSWAP AGENT: 10:49:52.403 INFO (org.hotswap.agent.plugin.spring.getbean.DetachableBeanHolder) - 25 Spring proxies reset

Now when you rerun System.out.println(app.getBeanNamesForType(Test.class).length);, you get

1

and things no longer work as expected.

@edudant
Copy link
Contributor

edudant commented May 4, 2018

Caused by #219, I reverted several changes from this issue.

@edudant
Copy link
Contributor

edudant commented May 4, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants