The usual way without IOC containers would be:
new User("Names", 22);
where the parameter values ββhere are dynamic, as a result of which, for example, they are selected through the user presentation form, therefore they cannot be saved in a file.
TextField userNames = new TextField();
names = userNames.getText()
for other parameters.
Where:
@Component
public class User {
public User(String names, int age) {
.
.
.
}
}
How to initialize Userwhen passing constructor parameters, where User Autowiredto another class:
@Component
public class AnotherClass {
@Autowired
User user(....)????? // How do I do it here
.
.
.
}
source
share