Bean Scopes
Suppose you are working on an application that involves encrypting passwords before storing them in the database. The encryption part is carried out by a PasswordEncryptor class. This class provides you with a method that takes a plaintext password and returns an encrypted one. You need to create a bean of this class. What should be the scope of this bean? Choose the correct option from those given below.
(Hint: PasswordEncryptor only contains methods and no fields to maintain state. Hence, we need to create a stateless bean of PasswordEncryptor. Recall which bean scope is used for creating stateless beans.)
1) Prototype
2) Singleton
3) Request
4) SessionProvide right solution
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here