1

I am building a Java servlet which requires some jars(libs) for testing in the local server (e.g. Tomcat), but does not need these when the servlet is deployed to the production server (as these are already available in the production). Are there any best practices / approaches recommended to achieve this?

4

1 に答える 1

1

ライブラリ JAR をローカル アプリケーション サーバーのインストールに追加して、後でデプロイする本番サーバーと同じように見えるようにします。

Tomcat 6 以前の場合:

tomcat-dir/common/lib

編集: tomcat 6 以降の場合:

tomcat-dir/lib

その結果、ローカル サーバーで実行している他のアプリもこのライブラリを参照する可能性があります。しかし、それは問題ではないかもしれません 。Tomcat は、2 つの Web アプリケーションにある場合、同じライブラリ ファイルをメモリに 2 回ロードしますか?

于 2012-11-19T17:03:46.837 に答える