@Scopes annotation is used to indicate the scope of a bean, either singleton, prototype, request, session, or a few custom scopes.
To make the EmailService bean class a singleton, we need to annotate the class with @Scope and @Service. So, our EmailService class will look as follows:
package com.packt.springbeanannotation;import org.springframework.context.annotation.Scope;import org.springframework.stereotype.Service;@Service@Scope("singleton")public class EmailService { private String emailContent; private String toAddress; public EmailService() { System.out.print(" \n Object of EmailService is Created !!! "); } public String getEmailContent() { return emailContent; } public void setEmailContent(String ...