Hi!!
I am working in a project that use the command pattern, But the implementation of its use a combination between field injection and constructor injection.
For example
@Component
public class CustomCommand extends BaseCommand {
@Autowired
private CustomService customService;
private final String element;
public CustomCommand(String element){
this.element = element;
}
}
This command is called using BeanFactory.getBean(CustomCommand.class, "string").
I did see the next video https://www.youtube.com/watch?v=_IPhpgzpm9w where the implementation use the Factory desing pattern and the custom command are'nt the @Component.
Why shouldn't I use the first approach?
Comment From: wilkinsona
As with https://github.com/spring-projects/spring-boot/issues/39849, this sort of question doesn't belong here. Please respect our wishes as maintainers of this project and use Stack Overflow for questions.