コード例 #1
0
  @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);
  }
コード例 #2
0
ファイル: DefaultAppCore.java プロジェクト: pugang/jodd
  /**
   * 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);
    }
  }