@Test void getBlog() { Blog blogInstance1 = applicationContext.getBean("blog3", Blog.class); Blog blogInstance2 = applicationContext.getBean("blog3", Blog.class); assertThat(blogInstance1.equals(to(blogInstance2))); Author authorInstance1 = blogInstance1.getAuthor(); Author authorInstance2 = blogInstance2.getAuthor(); assertThat(authorInstance1.equals(to(authorInstance2))); }
@Bean(name = "blog3") @Scope("singleton") public Blog getBlog() { return new Blog(); }
SingletonInjectedPrototypeDemo { @Bean(name = "blog3") @Scope("singleton") public Blog getBlog() { return new Blog(); } }
SingletonInjectedPrototypeDemo { @Bean(name = "blog3") @Scope("singleton") public Blog getBlog() { return new Blog(); }  }
SingletonInjectedPrototypeDemo { @Bean(name = "blog3") @Scope("singleton") public Blog getBlog() { return new Blog(); }  @Bean(name = "blog3") @Scope("singleton") Blog getBlog(); @Bean(name = "author1") @Scope("prototype") Author getAuthor(); }
SingletonInjectedPrototypeDemo { @Bean(name = "blog3") @Scope("singleton") public Blog getBlog() { return new Blog(); }  @Bean(name = "blog3") @Scope("singleton") Blog getBlog(); @Bean(name = "author1") @Scope("prototype") Author getAuthor();  }