1
私はストライプを使用しています。私はちょうどいくつかの構成のためのアプリケーションの起動時に使用されるいくつかのパラメータを追加したい。これを行うための最も単純な(または最良の)方法は何ですか?プロパティ、web.xmlまたは何ですか?私はストライプブック(ウェブサイトも)を検索しましたが、明確な答えが見つかりませんでした。ストライプを使用した単純なアプリケーション構成
私は通常、このようappConfig.propertiesファイルとリスナークラスを使用すると思い:
public class ConfigLoader implements javax.servlet.ServletContextListener {
public void contextInitialized(ServletContextEvent sce) {
Properties properties = System.getProperties();
properties.put(sce, sce);
try {
properties.load(this.getClass().getResourceAsStream("appConfig.properties"));
System.out.println(this.getClass().getResource("").getFile());
} catch (IOException ex) {
throw new ExceptionAdapter(ex);
}
}
public void contextDestroyed(ServletContextEvent sce) {
throw new UnsupportedOperationException("Not supported yet.");
}
}