jabrena / spring-boot-user-beans

A visual way to increase the developer awareness to minimize the number of Beans in memory.
https://jabrena.github.io/spring-boot-user-beans/
Apache License 2.0
52 stars 3 forks source link

Remove Beans in Spring [Bad practice] #23

Closed jabrena closed 1 year ago

jabrena commented 1 year ago
    ConfigurableApplicationContext ctx = SpringApplication.run(ProxyApplication.class, args);
    BeanDefinitionRegistry registry = (BeanDefinitionRegistry) ctx.getAutowireCapableBeanFactory();
    for(String beanName : ctx.getBeanDefinitionNames()){
        System.out.println(beanName);
        registry.removeBeanDefinition(beanName);
    }

https://stackoverflow.com/questions/38793661/removing-spring-beans-from-application-context

jabrena commented 1 year ago

https://chat.openai.com/share/65a0a5eb-2ac7-478b-87d9-7a62b3471ab2

jabrena commented 1 year ago

Bad practice

jabrena commented 1 year ago

https://github.com/jabrena/spring-boot-user-beans/issues/120