Tabnine Logo
PetiteRegistry$BeanRegister
Code IndexAdd Tabnine to your IDE (free)

How to use
PetiteRegistry$BeanRegister
in
jodd.petite

Best Java code snippets using jodd.petite.PetiteRegistry$BeanRegister (Showing top 7 results out of 315)

origin: org.jodd/jodd-petite

/**
 * Starts with bean registration. Example:
 * <code>bean(Foo.class).name("").scope(...).wiringMode(...).define().register();</code>
 *
 * @see PetiteBeans#registerPetiteBean(Class, String, Class, WiringMode, boolean, Consumer)
 */
public BeanRegister bean(final Class beanType) {
  return new BeanRegister(beanType);
}
origin: oblac/jodd

@Test
void testManualDefinition2() {
  PetiteRegistry petiteRegistry = PetiteRegistry.of(new PetiteContainer());
  petiteRegistry.bean(SomeService.class).register();
  petiteRegistry.bean(PojoBean.class).name("pojo").define().register();
  assertEquals(2, petiteRegistry.petiteContainer().beansCount());
  petiteRegistry.wire("pojo").ctor().bind();
  petiteRegistry.wire("pojo").property("service").ref("someService").bind();
  petiteRegistry.wire("pojo").method("injectService").ref("someService").bind();
  petiteRegistry.init("pojo").invoke(POST_INITIALIZE).methods("init").register();
  PojoBean pojoBean = petiteRegistry.petiteContainer().getBean("pojo");
  SomeService ss = petiteRegistry.petiteContainer().getBean("someService");
  assertNotNull(pojoBean);
  assertNotNull(ss);
  assertSame(ss, pojoBean.fservice);
  assertSame(ss, pojoBean.service);
  assertSame(ss, pojoBean.service2);
  assertEquals(1, pojoBean.count);
}
origin: oblac/jodd

@Test
void testManualRegistration2() {
  PetiteContainer pc = new PetiteContainer();
  PetiteRegistry.of(pc).bean(SomeService.class).register();
  PetiteRegistry.of(pc).bean(PojoBean.class).name("pojo").register();
  assertEquals(2, pc.beansCount());
  PetiteRegistry.of(pc).wire("pojo").ctor().bind();
  PetiteRegistry.of(pc).wire("pojo").property("service").ref("someService").bind();
  PetiteRegistry.of(pc).wire("pojo").method("injectService").ref("someService").bind();
  PetiteRegistry.of(pc).init("pojo").invoke(POST_INITIALIZE).methods("init").register();
  PojoBean pojoBean = pc.getBean("pojo");
  SomeService ss = pc.getBean("someService");
  assertNotNull(pojoBean);
  assertNotNull(ss);
  assertSame(ss, pojoBean.fservice);
  assertSame(ss, pojoBean.service);
  assertSame(ss, pojoBean.service2);
  assertEquals(1, pojoBean.count);
}
origin: oblac/jodd

@Test
void testManualRegistrationUsingAnnotations2() {
  PetiteContainer pc = new PetiteContainer();
  PetiteRegistry.of(pc).bean(SomeService.class).register();
  PetiteRegistry.of(pc).bean(PojoAnnBean.class).name("pojo").register();
  assertEquals(2, pc.beansCount());
  PojoAnnBean pojoBean = pc.getBean("pojo");
  SomeService ss = pc.getBean("someService");
  assertNotNull(pojoBean);
  assertNotNull(ss);
  assertSame(ss, pojoBean.fservice);
  assertSame(ss, pojoBean.service);
  assertSame(ss, pojoBean.service2);
  assertEquals(1, pojoBean.count);
}
origin: oblac/jodd

@Test
void testManualDefinitionUsingAnnotations2() {
  PetiteContainer pc = new PetiteContainer();
  PetiteRegistry.of(pc).bean(SomeService.class).register();
  PetiteRegistry.of(pc).bean(PojoAnnBean.class).name("pojo").define().register();
  assertEquals(2, pc.beansCount());
  PojoAnnBean pojoBean = pc.getBean("pojo");
  SomeService ss = pc.getBean("someService");
  assertNotNull(pojoBean);
  assertNotNull(ss);
  assertSame(ss, pojoBean.fservice);
  assertNull(pojoBean.service);
  assertNull(pojoBean.service2);
  assertEquals(0, pojoBean.count);
}
origin: oblac/jodd

/**
 * Starts with bean registration. Example:
 * <code>bean(Foo.class).name("").scope(...).wiringMode(...).define().register();</code>
 *
 * @see PetiteBeans#registerPetiteBean(Class, String, Class, WiringMode, boolean, Consumer)
 */
public BeanRegister bean(final Class beanType) {
  return new BeanRegister(beanType);
}
origin: oblac/jodd

  @Test
  void testWiringMethodArguments() {
    PetiteContainer pc = new PetiteContainer();

    pc.config().setDefaultWiringMode(WiringMode.OPTIONAL);

    PetiteRegistry petiteRegistry = pc.createContainerRegistry();

    petiteRegistry.bean(DaDrum.class).register();
    petiteRegistry.bean(Guitar.class).register();
    petiteRegistry.bean(TheBand.class).register();

    TheBand theBand = pc.getBean(TheBand.class);

    assertTrue(theBand.isBandReady());
  }
}
jodd.petitePetiteRegistry$BeanRegister

Most used methods

  • <init>
  • define
    Bean will be defined rather just registered.
  • name
    Defines bean name. If missing, it will be resolved from type name.
  • register
    Registers a bean.

Popular in Java

  • Running tasks concurrently on multiple threads
  • findViewById (Activity)
  • setScale (BigDecimal)
  • runOnUiThread (Activity)
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • JOptionPane (javax.swing)
  • JTextField (javax.swing)
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now