Protoype bean scope - real world usage
Protoype scope illustration using Token Generator import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; @SpringBootApplication public class PrototypeScopeExample { public static void main(String[] args) { SpringApplication.run(PrototypeScopeExample.class, args); } } @Component @Scope("prototype") class PrototypeBean { private String message; public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } } @Component class ClientBean { @Autowired private PrototypeBean prototypeBean; public void printMessage() { prototypeBean.setMessage("Hello, World!"); System.out.pr...