I have email config class like this.
@Configuration
public class EmailConfiguration {
@Autowired
private ConfigService configService;
@Bean
public JavaMailSender JavaMailSender() {
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
mailSender.setHost(configService.emailHost());
mailSender.setPort(configService.emailPort());
mailSender.setUsername(configService.emailAddress());
mailSender.setPassword(configService.emailPassword());
return mailSender;
}
}
how to make this bean change the value at runtime every ConfigService was refreshed? I was refresh the ConfigService but the bean's value did not change.
question from:https://stackoverflow.com/questions/65713073/how-to-reload-re-init-bean-in-spring-boot