@Service
public class test(){
public Map<String, String> map= new HashMap<>();
}
in a web application using spring i annotated a class with @Service
and defined a global variable map and inserting values in it.
i assumed
map hold inserted values until some one restart the server or remove by using map.remove()
;
but my senior told me it will hold only for some time after some ideal time and garbage collector will remove it like after 2 or 3 days is that true ?