I was wondering when I should use setServletContext.setAttribute(), at the start up of the application, to store data.
I suppose I should use it to store data that I share among many classes of my web application.
For example: so far, I had a website in which I read the address, emails etc from a .properties file. I print address, emails etc in many pages, so I created a class (ConfigurationData.class) which reads that .properties file, and every class that need to know address, email etc "@Autowires" the ConfigurationData.class.
I was wondering if instead of @Autowired ConfigurationData.class in many other classes I should use setServletContext.setAttribute() at the start up of the application.
Which solution "use" less server resources?
Since every "@Autowired" class is a singleton, using many time "@Autowired" for the same class shoudn't be "heavy" for the server, should be?
Thank you in advance.