Initialize singleton in Java Jersey 2 JAX-RS

Viewed 8106

I'm new to Jersey (2.22.2), so bear with me please. I am creating a REST service that interfaces with an LDAP server for storing, removing, and retrieving user data. The service acts as a security intermediary by performing encryption/decryption.

There is quite a bit of initialization that must take place before the REST services can be utilized, and I would like to only perform this initialization once (when the application is deployed on the server). So this service would be run as a singleton.

Would appreciate if someone could give me some pointers on the best way to go about doing this? Thanks!

3 Answers
Related