@Test void getBlog() { Blog blogInstance1 = applicationContext.getBean("blog1", Blog.class); Blog blogInstance2 = applicationContext.getBean("blog1", Blog.class); assertThat(blogInstance1.equals(to(blogInstance2))); }
@Bean(name = "blog1") @Scope("singleton") public Blog getBlog() { return new Blog(); }
SingletonDemo { @Bean(name = "blog1") @Scope("singleton") public Blog getBlog() { return new Blog(); } }
SingletonDemo { @Bean(name = "blog1") @Scope("singleton") public Blog getBlog() { return new Blog(); }  }
SingletonDemo { @Bean(name = "blog1") @Scope("singleton") public Blog getBlog() { return new Blog(); }  @Bean(name = "blog1") @Scope("singleton") Blog getBlog(); }
SingletonDemo { @Bean(name = "blog1") @Scope("singleton") public Blog getBlog() { return new Blog(); }  @Bean(name = "blog1") @Scope("singleton") Blog getBlog();  }