Spring reload application context on request

I have a class that extends PropertyPlacerHolderConfig, where after starting the application all properties from the database are loaded. Then the rest of the Spring definition configuration uses these properties, for example the scheduler time of my Quartz task

But what I am doing now is the section on managing my application in which the client can change these properties in the database. But for now, the only way to force the application to use these new values ​​is to restart the service manually, and I want to avoid this.

Sincerely.

+4
source share
2 answers

beans, . ? , .

:

@Autowired
private ApplicationContext applicationContext;

public void onEmailConfChange()
{
Properties properties = dao.getEmailConf();
EmailService emailService = (EmailService) applicationContext
            .getBean("emailService");
emailService.setConfiguration(properties);
}
+1

. , , ?

: , , .

, spring. , bean. , , , ( )

, spring , . , , , (, ..), .

, spring , ,

: 1. ? 2. ?

, , , , . , , , , , .

, (-) . , . - Zoo Keeper , Out Of the Box ..

,

0

All Articles