0

I need a utility class which only has to generate a relatively complex file from a given input. The input differs, the process of generating the file is always the same.

Now the question: Would it be better to use an @ApplicationScoped bean or just a class using the Singleton Pattern and work with static methods?

As far as i know both classes are only instatiated once per JVM and also kept in memory only once. I do not need an inject, the singleton would work fine. Are there any advantages for my performance or the memory usage using one of the listed possibilites?

sofarsoghood
  • 243
  • 2
  • 16
  • Did you look at this: https://stackoverflow.com/questions/4555844/what-is-the-difference-between-applicationscoped-and-singleton-scopes-in-cdi – Aragorn May 15 '18 at 14:10
  • yes i did, i am not talking about the @Singleton annotation, i am talking about the pattern: https://www.tutorialspoint.com/design_pattern/singleton_pattern.htm – sofarsoghood May 15 '18 at 14:20

0 Answers0