Amit P
Amit P

Reputation: 544

Can a CDI bean or JSF Managed bean implement any custom interface

Is it ok to implement other custom interfaces for a CDI or JSF session scoped bean.

Upvotes: 0

Views: 409

Answers (2)

Petr Mensik
Petr Mensik

Reputation: 27496

Yes, it is. And it's even desired in the case of CDI because you can have an interface which represents some service and than have multiple implementations of this service. Each implementation can have it's own qualifier and can be injected into the client by this qualifier, thus hiding it's actual implementation.

Upvotes: 4

Vasil Lukach
Vasil Lukach

Reputation: 3728

Yes, managed bean can implement custom interface.

Upvotes: 3

Related Questions