1

I am following this tutorial.

It uses @Scope("session") and @SessionScoped in different implementations.

What are the differences?

Kukeltje
  • 12,085
  • 4
  • 21
  • 46
GYSM
  • 13
  • 4

1 Answers1

1

It is actually explained in the tutorial:

Mixed use of both JSF and Spring annotations are working fine, but it look weird and duplicated – @Component and @ManagedBean together. Actually, you can just uses a single @Component, see following new version, it’s pure Spring, and it works!

So the @SessionScoped is the JSF solution. And @Scope("session") is the pure Spring solution.

Using the @SessionScoped will make your application more portable, when for example you want to switch to Java EE. However using Spring-DI gives you a more consistent implementation.

Albert Bos
  • 1,903
  • 1
  • 13
  • 25