Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Spring ベースの Java Web サービスを開発しています。アプリケーションの起動時 (アプリケーション サーバーがコンテキストを起動するとき) に UUID を生成し、アプリケーションの有効期間中は変更しないようにする必要があります。1 つ以上のサービス クラス (@Service を使用) がこの変数にアクセスする必要があります。UUID は、コンテキストが再起動された場合 (アプリケーションの再デプロイまたはアプリケーション サーバーの再起動) にのみ変更できます。
通常のシングルトンを宣言し、使用するだけclass="java.util.UUID" factory-method="randomUUID"です。通常どおり、他の Bean から参照します。
class="java.util.UUID" factory-method="randomUUID"