Database
There are 2 types of databases in the application.
Persistent
Most of the data needs to be stored persistently because these kind of data needs to be available even if the application restarts. This kind of data includes the users, their effects or their devices. A MySQL relational database is used for this purpose.
In-memory
There are some data that doesn't need to be stored persistently. This includes the tokens generated by Spotify. These tokens are like passwords is nature they provide access to the user's Spotify resources. If an attacker gets them it can be easily abused. Since the in-memory database exists purely in the memory it can not be accessed so easily. Another not negligible advantage is that it's much faster to access since the data is in memory not on a disk. The reason that it's useful because it provides the abstraction of a database, and we can store the data without having to worry about the transactional operations or race conditions. The obvious disadvantage that every data is erased once the application is restarted but it is not a problem in case of the Spotify tokens. The only inconvenience it causes that the users can not refresh their tokens, so they have to log in again once their access token expires. All this functionality is provided by a Hibernate database in the application.
The reason these Spotify tokens are stored in the first place is that the middleware component needs it to be able to query the currently listened track information.