Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
xml
xml
@Scope(ScopeType.PROTOTYPE)
@Provider
public class MyProvider implements MessageBodyReader<String>{
    ...
}

Singleton Example 1

The following example shows how to define a provider with a singleton lifecycle.

Code Block
xml
xml
@Scope(ScopeType.SINGELTON)
@Provider
public class MyProvider implements MessageBodyReader<String>{
    ...
}

Singleton Example 2

The following example shows that when the @Scope annotation is not used, the provider will be a singleton, as per the JAX-RS specification.

...