javax.enterprise.inject.spi.Bean.getScope()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(185)

本文整理了Java中javax.enterprise.inject.spi.Bean.getScope()方法的一些代码示例,展示了Bean.getScope()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bean.getScope()方法的具体详情如下:
包路径:javax.enterprise.inject.spi.Bean
类名称:Bean
方法名:getScope

Bean.getScope介绍

[英]Returns scope of a bean.
[中]返回bean的作用域。

代码示例

代码示例来源:origin: org.jboss.cdi.tck/cdi-tck-impl

@Test
@SpecAssertion(section = DECLARING_PRODUCER_FIELD, id = "b")
public void testScopeType() {
  Set<Bean<Tarantula>> tarantulaBeans = getBeans(Tarantula.class, TAME_LITERAL, FOO_LITERAL);
  assert !tarantulaBeans.isEmpty();
  Bean<Tarantula> tarantulaModel = tarantulaBeans.iterator().next();
  assert tarantulaModel.getScope().equals(RequestScoped.class);
}

代码示例来源:origin: org.jboss.jsr299.tck/jsr299-tck-impl

@Test(groups = { "new" })
@SpecAssertion(section = "3.12", id = "p")
public void testNewBeanIsDependentScoped()
{
 Set<Bean<WrappedEnterpriseBeanLocal>> beans = getBeans(WrappedEnterpriseBeanLocal.class, WrappedEnterpriseBeanLocal.NEW);
 assert beans.size() == 1;
 Bean<WrappedEnterpriseBeanLocal> newEnterpriseBean = beans.iterator().next();
 assert Dependent.class.equals(newEnterpriseBean.getScope());
}

代码示例来源:origin: org.jboss.jsr299.tck/jsr299-tck-impl

@Test(groups = "producerField")
@SpecAssertion(section = "3.4.2", id = "b")
public void testScopeType()
{
 Set<Bean<Tarantula>> tarantulaBeans = getBeans(Tarantula.class, TAME_LITERAL, FOO_LITERAL);
 assert !tarantulaBeans.isEmpty();
 Bean<Tarantula> tarantulaModel = tarantulaBeans.iterator().next();
 assert tarantulaModel.getScope().equals(RequestScoped.class);
}

代码示例来源:origin: org.jboss.jsr299.tck/jsr299-tck-impl

@Test
@SpecAssertion(section = "4.1", id = "hhj")
public void testStereotypeScopeIsOverriddenByInheritedScope()
{
 assert getBeans(ChihuahuaLocal.class).iterator().next().getScope().equals(SessionScoped.class);
}

代码示例来源:origin: org.jboss.jsr299.tck/jsr299-tck-impl

@Test
@SpecAssertion(section = "4.1", id = "bc")
public void testScopeTypeDeclaredInheritedIsIndirectlyInherited()
{
 assert getBeans(EnglishBorderCollie.class).iterator().next().getScope().equals(RequestScoped.class);
}

代码示例来源:origin: org.jboss.cdi.tck/cdi-tck-impl

@Test(groups = INTEGRATION)
@SpecAssertion(section = TYPE_LEVEL_INHERITANCE_EE, id = "bea")
public void testScopeTypeNotDeclaredInheritedIsNotInherited() throws Exception {
  assert !getBeans(SiameseLocal.class).iterator().next().getScope().equals(FooScoped.class);
}

代码示例来源:origin: org.jboss.cdi.tck/cdi-tck-impl

@Test
@SpecAssertion(section = TYPE_LEVEL_INHERITANCE, id = "ba")
public void testScopeTypeDeclaredInheritedIsInherited() throws Exception {
  assert getBeans(BorderCollie.class).iterator().next().getScope().equals(RequestScoped.class);
}

代码示例来源:origin: org.jboss.jsr299.tck/jsr299-tck-impl

@Test
@SpecAssertion(section = "4.1", id = "am")
public void testStereotypeDeclaredInheritedIsInherited() throws Exception
{
 assert getBeans(BorderCollieLocal.class).iterator().next().getScope().equals(RequestScoped.class);
}

代码示例来源:origin: org.jboss.jsr299.tck/jsr299-tck-impl

@Test
  @SpecAssertion(section = "4.1", id = "bha")
  public void testScopeTypeNotDeclaredInheritedIsNotIndirectlyInherited()
  {
   assert !getBeans(BengalTigerLocal.class).iterator().next().getScope().equals(FooScoped.class);
  }
}

代码示例来源:origin: org.jboss.cdi.tck/cdi-tck-impl

@Test(groups = INTEGRATION)
@SpecAssertion(section = TYPE_LEVEL_INHERITANCE_EE, id = "aq")
public void testStereotypeDeclaredInheritedIsIndirectlyInherited() {
  assert getBeans(EnglishBorderCollieLocal.class).iterator().next().getScope().equals(RequestScoped.class);
}

代码示例来源:origin: org.jboss.cdi.tck/cdi-tck-impl

@Test(groups = INTEGRATION)
@SpecAssertion(section = TYPE_LEVEL_INHERITANCE_EE, id = "aqa")
public void testStereotypeNotDeclaredInheritedIsNotIndirectlyInherited() {
  assert !getBeans(TameBarracudaLocal.class).iterator().next().getScope().equals(RequestScoped.class);
}

代码示例来源:origin: org.jboss.cdi.tck/cdi-tck-impl

@Test(groups = INTEGRATION)
@SpecAssertion(section = TYPE_LEVEL_INHERITANCE_EE, id = "hhj")
public void testStereotypeScopeIsOverriddenByInheritedScope() {
  assert getBeans(ChihuahuaLocal.class).iterator().next().getScope().equals(SessionScoped.class);
}

代码示例来源:origin: org.jboss.cdi.tck/cdi-tck-impl

@Test(groups = INTEGRATION)
  @SpecAssertion(section = TYPE_LEVEL_INHERITANCE_EE, id = "bha")
  public void testScopeTypeNotDeclaredInheritedIsNotIndirectlyInherited() {
    assert !getBeans(BengalTigerLocal.class).iterator().next().getScope().equals(FooScoped.class);
  }
}

代码示例来源:origin: org.jboss.cdi.tck/cdi-tck-impl

@Test
@SpecAssertion(section = ALTERNATIVE_METADATA_SOURCES, id = "l")
public void testGetAnnotationUsedForGettingScopeInformation() {
  // @ApplicationScoped is overridden by @RequestScoped
  assertEquals(getBeans(Grocery.class, Any.Literal.INSTANCE).iterator().next().getScope(), RequestScoped.class);
}

代码示例来源:origin: org.jboss.jsr299.tck/jsr299-tck-impl

@Test
@SpecAssertion(section = "4.1", id = "ama")
public void testStereotypeNotDeclaredInheritedIsNotInherited() throws Exception
{
 assert !getBeans(BarracudaLocal.class).iterator().next().getScope().equals(RequestScoped.class);
}

代码示例来源:origin: org.jboss.jsr299.tck/jsr299-tck-impl

@Test
@SpecAssertion(section = "4.1", id = "aqa")
public void testStereotypeNotDeclaredInheritedIsNotIndirectlyInherited()
{
 assert !getBeans(TameBarracudaLocal.class).iterator().next().getScope().equals(RequestScoped.class);
}

代码示例来源:origin: org.jboss.jsr299.tck/jsr299-tck-impl

@Test
@SpecAssertion(section = "4.1", id = "bh")
public void testScopeTypeDeclaredInheritedIsIndirectlyInherited()
{
 assert getBeans(EnglishBorderCollieLocal.class).iterator().next().getScope().equals(RequestScoped.class);
}

代码示例来源:origin: org.jboss.jsr299.tck/jsr299-tck-impl

@Test
@SpecAssertion(section = "5.6.2", id = "d")
public void testScopeOfBuiltinInstance() 
{
  Bean<Instance<Cow>> bean = getBeans(new TypeLiteral<Instance<Cow>>() {}).iterator().next();
  assert Dependent.class.equals(bean.getScope());
}

代码示例来源:origin: org.jboss.jsr299.tck/jsr299-tck-impl

@Test @SpecAssertion(section="4.1", id = "ba")
public void testScopeTypeDeclaredInheritedIsInherited() throws Exception
{
 assert getBeans(BorderCollie.class).iterator().next().getScope().equals(RequestScoped.class);
}

代码示例来源:origin: org.jboss.jsr299.tck/jsr299-tck-impl

@Test
@SpecAssertion(section = "4.1", id = "ah")
public void testStereotypeDeclaredInheritedIsIndirectlyInherited()
{
 assert getBeans(EnglishBorderCollie.class).iterator().next().getScope().equals(RequestScoped.class);
}

相关文章