1

I have a @ConversationScoped CDI bean with a Conversation interface injected and access modifier set as private. Something like this:

@Named
@ConversationScoped
public class MySampleCdiBean implements Serializable {

    @Inject
    private Conversation conversation;

    //other stuffs
}

My question is do I need a getter for this injected conversation interface? Does the CDI container need this getter? Any resource from where I can understand the underlying details of how CDI container handles a conversation would be super helpful too.

mushfek0001
  • 3,845
  • 1
  • 21
  • 20

1 Answers1

0

There are multiple ways to define an injection point on the injected class. So far you have annotated the fields that reference the injected object. You do not need to provide getters and setters for field injection.

More information can be found here: https://netbeans.org/kb/docs/javaee/cdi-inject.html

hope its helpful.

Abhijeet Kale
  • 1,656
  • 1
  • 16
  • 34