protected void initPropertiesPlaceHolder( ConfigurableApplicationContext context, AcServiceConfig serviceConfig) { // prepare properties from service config Properties prop = new Properties(); for (String key : serviceConfig.getKeys()) { // NOTE: use data from service property (preferences + default) prop.setProperty(key, serviceConfig.getProperty(key)); } // TODO (other better way) other core reserved properties prop.setProperty( "ac.context.sessionId", String.valueOf(serviceConfig.getCoreContext().getSession().getSessionId())); prop.setProperty( "ac.context.profileId", String.valueOf(serviceConfig.getCoreContext().getSession().getProfile().getProfileId())); PropertyPlaceholderConfigurer propConfig = new PropertyPlaceholderConfigurer(); propConfig.setProperties(prop); context.addBeanFactoryPostProcessor(propConfig); }
protected void validateConfig(AcServiceConfig serviceConfig, String key) throws AcServiceException { if (serviceConfig.getProperty(key) == null) { throw new AcServiceException("service property '" + key + "' not found"); } }