@Before
  public void init() {

    petite = new PetiteContainer();

    // load parameters
    Props appProps = new Props();
    PropsUtil.loadFromClasspath(appProps, "/props.props");
    petite.defineParameters(appProps);

    // add appCore to Petite (and resolve parameters)
    AutomagicPetiteConfigurator pcfg = new AutomagicPetiteConfigurator();
    pcfg.setIncludedEntries(this.getClass().getPackage().getName() + ".*");
    pcfg.configure(petite);
  }
Beispiel #2
0
  /**
   * Creates and loads application props. It first loads system properties (registered as <code>
   * sys.*</code>) and then environment properties (registered as <code>env.*</code>). Finally,
   * props files are read from the classpath. All properties are loaded using
   *
   * <p>If props have been already loaded, does nothing.
   */
  protected void initProps() {
    if (appProps != null) {
      return;
    }

    appProps = createProps();

    appProps.loadSystemProperties("sys");
    appProps.loadEnvironment("env");

    PropsUtil.loadFromClasspath(appProps, appPropsNamePattern);

    if (appPropsProfiles != null) {
      appProps.setActiveProfiles(appPropsProfiles);
    }
  }