I have method in my web service which loads the same mySQL data into an array every time it is called. It’s a fairly large amount of data and it would be much more efficient if this could be done once when the service is started, instead of for every single request.
I’ve searched around but can’t see any examples of how to achieve this, is it possible and if so – how?
Thanks!
You should do it something like
this way you will only have one trip to the database to populate the data. Alternatively since you are using Jersey you could extend
Applicationand populate you data that way when registering the classes