@PostConstruct public void init() { applications = this.appService.findAll(); // Title Label title = new Label("<h2>Applications</h2>", ContentMode.HTML); initApplicationsGrid(); // Build layout VerticalLayout leftLayout = new VerticalLayout(title, grid); leftLayout.setMargin(false); this.addComponent(leftLayout); // Center align layout this.setWidth("100%"); this.setMargin(new MarginInfo(false, true)); }
@PostConstruct public void init() { try { sendEmailRequestClazz = Class.forName("com.ctrip.framework.apolloctripservice.emailservice.SendEmailRequest"); setSendCode = sendEmailRequestClazz.getMethod("setSendCode", String.class); setBodyTemplateID = sendEmailRequestClazz.getMethod("setBodyTemplateID", Integer.class); setSender = sendEmailRequestClazz.getMethod("setSender", String.class); setBodyContent = sendEmailRequestClazz.getMethod("setBodyContent", String.class); setRecipient = sendEmailRequestClazz.getMethod("setRecipient", List.class); setSubject = sendEmailRequestClazz.getMethod("setSubject", String.class); setIsBodyHtml = sendEmailRequestClazz.getMethod("setIsBodyHtml", Boolean.class); setCharset = sendEmailRequestClazz.getMethod("setCharset", String.class); setExpiredTime = sendEmailRequestClazz.getMethod("setExpiredTime", Calendar.class); setAppID = sendEmailRequestClazz.getMethod("setAppID", Integer.class); } catch (Throwable e) { logger.error("init email request build failed", e); Tracer.logError("init email request build failed", e); } }
/** * Initializes BuenOjo. * <p/> * Spring profiles can be configured with a program arguments --spring.profiles.active=your-active-profile * <p/> * <p> * You can find more information on how profiles work with JHipster on <a href="http://jhipster.github.io/profiles.html">http://jhipster.github.io/profiles.html</a>. * </p> */ @PostConstruct public void initApplication() throws IOException { if (env.getActiveProfiles().length == 0) { log.warn("No Spring profile configured, running with default configuration"); } else { log.info("Running with Spring profile(s) : {}", Arrays.toString(env.getActiveProfiles())); Collection<String> activeProfiles = Arrays.asList(env.getActiveProfiles()); if (activeProfiles.contains(Constants.SPRING_PROFILE_DEVELOPMENT) && activeProfiles.contains(Constants.SPRING_PROFILE_PRODUCTION)) { log.error("You have misconfigured your application! " + "It should not run with both the 'dev' and 'prod' profiles at the same time."); } if (activeProfiles.contains(Constants.SPRING_PROFILE_PRODUCTION) && activeProfiles.contains(Constants.SPRING_PROFILE_FAST)) { log.error("You have misconfigured your application! " + "It should not run with both the 'prod' and 'fast' profiles at the same time."); } if (activeProfiles.contains(Constants.SPRING_PROFILE_DEVELOPMENT) && activeProfiles.contains(Constants.SPRING_PROFILE_CLOUD)) { log.error("You have misconfigured your application! " + "It should not run with both the 'dev' and 'cloud' profiles at the same time."); } } }
@PostConstruct private void init() { callbackUrl = HttpURL.build(apiDomain).append("/hooks/sync").toString(); taskExecutor.execute(() -> { try { LOGGER.trace("Start to init agent list in thread: " + Thread.currentThread().getName()); load(); List<Agent> agents = agentService.list(); for (Agent agent : agents) { if (agent.getStatus() == AgentStatus.OFFLINE) { continue; } register(agent.getPath()); } } catch (Throwable e) { LOGGER.warn(e.getMessage()); } }); }
@PostConstruct public void init() { heroes = new HashMap<>(); LOGGER.info("Building heroes library"); String heroStatsJson = steamClient.getResponseFromOpenDota("heroStats"); Hero[] stats = new Gson().fromJson(heroStatsJson, Hero[].class); for(Hero hero : stats) { try { heroes.put(hero.getLocalized_name().toLowerCase(), hero); LOGGER.info("Added hero : {}", hero.getLocalized_name()); } catch(Exception e) { LOGGER.info("Error adding hero {}", e); } } }
@PostConstruct public Pattern getRegexPassages() { if (regexPassages == null) { Set<String> shortcutsBooks = bibleCsvRepository.findBible(bibleCsvRepository.getDefaultBible()) .getBooks() .stream() .map(BookDTO::getShortcuts) .reduce((strings, strings2) -> Stream.concat(strings.stream(), strings2.stream()).collect(Collectors.toSet())) .orElse(new HashSet<>()); regexPassages = Pattern.compile("([a-zA-Z0-9])?(" + shortcutsBooks.stream().reduce((s, s2) -> s + "|" + s2).orElse("") + ")\\.?\\s*(\\d{1,3})(?:\\s*[\\:\\s|\\,\\s]\\s*(\\d{1,3})(?:\\s*[\\-\\s]\\s*(\\d{1,3}))?)?"); } return regexPassages; }
@PostConstruct public void init() { properties.put("bootstrap.servers", "127.0.0.1:9092"); properties.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer"); properties.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer"); properties.put("acks", "-1"); properties.put("retries", 0); properties.put("batch.size", 16384); properties.put("linger.ms", 0); properties.put("buffer.memory", 33554432); try { this.producer = new KafkaProducer<>(properties); } catch (Exception e) { log.error("Failed to start kafka producer", e); throw new RuntimeException(e); } log.info("Kafka Producer is started...."); }
@PostConstruct public final void start() { init(); final String scheduledName = "scheduled_" + getName(); ExecutorService executorService = Executors.newSingleThreadExecutor(ThreadUtils.newDaemonThreadFactory(scheduledName, Thread.MIN_PRIORITY)); executorService.execute(new Runnable() { @Override public void run() { while (true) { if (!isFrequently()) { ThreadUtils.sleepSeconds((long) (3600 * (Math.random() + 1))); } try { AbstractIpAgentCallable.this.run(); } catch (Exception e) { LOGGER.error(" scheduledExecutorService scheduledName {} error...", scheduledName, e); } ThreadUtils.sleepSeconds((long) (getIntervalSeconds() * (Math.random() + 1))); } } }); }
@PostConstruct public void setup() { MockitoAnnotations.initMocks(this); MultipleChoiceSubjectSpecificResource multipleChoiceSubjectSpecificResource = new MultipleChoiceSubjectSpecificResource(); ReflectionTestUtils.setField(multipleChoiceSubjectSpecificResource, "multipleChoiceSubjectSpecificRepository", multipleChoiceSubjectSpecificRepository); this.restMultipleChoiceSubjectSpecificMockMvc = MockMvcBuilders.standaloneSetup(multipleChoiceSubjectSpecificResource) .setCustomArgumentResolvers(pageableArgumentResolver) .setMessageConverters(jacksonMessageConverter).build(); }
@PostConstruct private void buildDatabase() { users.forEach(user -> { try { processUser(user); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("error while processing user " + user.email, e); } }); }
@PostConstruct private void initialize() { add(createPanel()); // addButtonHandlers(); /** * Es necesario mostrar durante un instante el diálogo para que la * configuración del tamaño y del grid se realice correctamente */ this.show(); this.hide(); }
@PostConstruct public void init() { objectMapper = new ObjectMapper(); final HttpClientBuilder clientBuilder = HttpClientBuilder.create(); if (StringUtils.hasText(camundaUser)) { final BasicCredentialsProvider provider = new BasicCredentialsProvider(); provider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(camundaUser, camundaPass)); clientBuilder.setDefaultCredentialsProvider(provider); } httpClient = clientBuilder.build(); }
@PostConstruct public void generateTestData() { itemRepository.save(new Item("iPod", 42.0)); itemRepository.save(new Item("iPod touch", 21.0)); itemRepository.save(new Item("iPod nano", 1.0)); itemRepository.save(new Item("Apple TV", 100.0)); }
@PostConstruct private void init() { kafkaProperties.put("group.id", "order-handler"); String chef = kafkaProperties.getProperty("chef.topic"); eventConsumer = new EventConsumer(kafkaProperties, ev -> events.fire(ev), chef); mes.execute(eventConsumer); }
/** * Schedule reloader job. */ @PostConstruct public void scheduleReloaderJob() { try { if (shouldScheduleLoaderJob()) { LOGGER.debug("Preparing to schedule reloader job"); final JobDetail job = JobBuilder.newJob(ServiceRegistryReloaderJob.class) .withIdentity(this.getClass().getSimpleName().concat(UUID.randomUUID().toString())) .build(); final Trigger trigger = TriggerBuilder.newTrigger() .withIdentity(this.getClass().getSimpleName().concat(UUID.randomUUID().toString())) .startAt(DateTime.now().plusSeconds(this.startDelay).toDate()) .withSchedule(SimpleScheduleBuilder.simpleSchedule() .withIntervalInSeconds(this.refreshInterval) .repeatForever()).build(); LOGGER.debug("Scheduling {} job", this.getClass().getName()); scheduler.scheduleJob(job, trigger); LOGGER.info("Services manager will reload service definitions every {} seconds", this.refreshInterval); } } catch (final Exception e) { LOGGER.warn(e.getMessage(), e); } }
@PostConstruct public void init() { log.debug("Registering JVM gauges"); metricRegistry.register(PROP_METRIC_REG_JVM_MEMORY, new MemoryUsageGaugeSet()); metricRegistry.register(PROP_METRIC_REG_JVM_GARBAGE, new GarbageCollectorMetricSet()); metricRegistry.register(PROP_METRIC_REG_JVM_THREADS, new ThreadStatesGaugeSet()); metricRegistry.register(PROP_METRIC_REG_JVM_FILES, new FileDescriptorRatioGauge()); metricRegistry.register(PROP_METRIC_REG_JVM_BUFFERS, new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer())); if (hikariDataSource != null) { log.debug("Monitoring the datasource"); hikariDataSource.setMetricRegistry(metricRegistry); } if (jHipsterProperties.getMetrics().getJmx().isEnabled()) { log.debug("Initializing Metrics JMX reporting"); JmxReporter jmxReporter = JmxReporter.forRegistry(metricRegistry).build(); jmxReporter.start(); } if (jHipsterProperties.getMetrics().getLogs().isEnabled()) { log.info("Initializing Metrics Log reporting"); final Slf4jReporter reporter = Slf4jReporter.forRegistry(metricRegistry) .outputTo(LoggerFactory.getLogger("metrics")) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); reporter.start(jHipsterProperties.getMetrics().getLogs().getReportFrequency(), TimeUnit.SECONDS); } }
@PostConstruct public void init(){ System.out.println("MoneyTransfertService.init()"); if(emf== null || !emf.isOpen()){ emf=Persistence.createEntityManagerFactory("beosbank-mt-unit"); } em=emf.createEntityManager(); }
@PostConstruct public void init() throws Exception { // 监听连接状态 zkManager.addConnectionStateListener(stateListener); // 生成初始集群机器ID rebuildDatacenterId(); isWorking = true; log.info("idGenerator is isWorking!"); }
/** * 创建Zookeeper连接 * * @throws InterruptedException * @throws UnsupportedEncodingException */ @PostConstruct public void connect() throws InterruptedException, UnsupportedEncodingException { client = CuratorFrameworkFactory.builder() .connectString(connectString) .retryPolicy(new ExponentialBackoffRetry(DEFAULT_BASE_SLEEP_TIME_MS, DEFAULT_MAX_RETRIES)) .namespace(DEFAULT_NAMESPACE) .authorization(DEFAULT_ACL_SCHEME, DEFAULT_ACL_AUTH.getBytes(DEFAULT_CHARSET)) // 设置权限 .aclProvider(new ACLProvider() { // 设置ACL规则 @Override public List<ACL> getDefaultAcl() { return DEFAULT_ACL_LIST; } @Override public List<ACL> getAclForPath(String path) { return DEFAULT_ACL_LIST; } }) .build(); if (CuratorFrameworkState.STARTED != client.getState()) { client.start(); } while (!client.blockUntilConnected(MAX_WAIT_SECONDS, TimeUnit.SECONDS)) { log.info("can not connect to zookeeper , retry again!!"); } }
/** * Initializes codemotion. * <p> * Spring profiles can be configured with a program arguments --spring.profiles.active=your-active-profile * <p> * You can find more information on how profiles work with JHipster on <a href="http://www.jhipster.tech/profiles/">http://www.jhipster.tech/profiles/</a>. */ @PostConstruct public void initApplication() { Collection<String> activeProfiles = Arrays.asList(env.getActiveProfiles()); if (activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) && activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_PRODUCTION)) { log.error("You have misconfigured your application! It should not run " + "with both the 'dev' and 'prod' profiles at the same time."); } if (activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) && activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_CLOUD)) { log.error("You have misconfigured your application! It should not " + "run with both the 'dev' and 'cloud' profiles at the same time."); } }
@PostConstruct public void init() { getColumnNamesMapping().put(SUBSCRIPTION_ID, TableColumns.SUBSCRIPTION_ID); getColumnNamesMapping().put(ROLE_IN_SUB, TableColumns.ROLE_IN_SUB); getSortOrders().put(SUBSCRIPTION_ID, SortOrder.unsorted); getSortOrders().put(ROLE_IN_SUB, SortOrder.unsorted); }
@PostConstruct private void initialize() { measure = mapControlFactory.createMesaureControl(); measure.addMeasureListener(getMeasureListener()); measure.addMeasurePartialListener(getPartialListener()); add(measure); }
@PostConstruct public void initProperty(){ // setDefaultRoles("ROLE_USER"); setCasServerUrlPrefix(ShiroCasConfiguration.casServerUrlPrefix); // 客户端回调地址 setCasService(ShiroCasConfiguration.shiroServerUrlPrefix + ShiroCasConfiguration.casFilterUrlPattern); }
@PostConstruct public void deployVerticles() { doWithConfiguration(config -> { vertx.deployVerticle(serviceVerticle, new DeploymentOptions().setConfig(config)); vertx.deployVerticle(restVerticle, new DeploymentOptions().setConfig(config)); }); }
@PostConstruct public void init() { blurFilter = new BoxBlurFilter(75); try { getCache(); } catch (IOException e) { LOGGER.error("Could not create blur cache folder", e); } }
/** * Configures application's root directory */ @PostConstruct public void configure() { makeDir(""); makeDir(TMP_DIR.getPath()); final Map<String, Object> params = new HashMap<>(); params.put(USER_ID.name(), AuthUtils.getCurrentUserId()); makeDir(substitute(USER_DIR, params)); }
@PostConstruct private void init() { Long id = WebUtil.getLongParamValue(GetParamNames.DIAGNOSIS_ID); if (id != null) { this.load(id); } else { initIn(); initSets(); } }
@PostConstruct public void init() throws InvalidDataException { if (configurationRepository.count() > 0) { loadConfiguration(); } else { loadAndUpdateDbConfiguration(); } logger.info("Configuration Service", toString()); }
@PostConstruct public void postConstructConfiguration() { // Expose ids for the domain entities having repositories logger.info("Exposing IDs on repositories..."); restConfiguration.config().exposeIdsFor(User.class); restConfiguration.config().exposeIdsFor(Product.class); restConfiguration.config().exposeIdsFor(Rating.class); // Register the ObjectMapper module for properly rendering HATEOAS REST repositories logger.info("Registering Jackson2HalModule..."); restConfiguration.objectMapper().registerModule(new Jackson2HalModule()); }
@PostConstruct protected void initialize() { if (this.model == null) { this.model = new PasswordRecoveryModel(); } final String marketplaceId = getMarketplaceId(); if (marketplaceId != null && (!marketplaceId.trim().equals(""))) { this.model.setMarketpalceId(marketplaceId); } this.setSessionAttribute(Constants.CAPTCHA_INPUT_STATUS, Boolean.FALSE); }
@PostConstruct void init() { logger.info("Slack Web API Url: " + slackUrl); String tokens = env.getProperty("slack.tokens"); if (tokens != null) { teamTokenMap = Arrays.stream(tokens.trim().split(",")) .map(s -> s.split("=")) .filter(s -> s.length == 2) .collect(toMap(e -> e[0].toLowerCase(), e -> e[1], (a, b) -> a)); } // Don't log slack tokens. logger.info("Initialized slack tokens for, " + teamTokenMap.keySet()); }
@PostConstruct public void init() { JobOperator operator = BatchRuntime.getJobOperator(); Properties jobProperties = operator.getParameters(jobContext.getExecutionId()); type = LegType.valueOf(jobProperties.getProperty((BatchConstants.PATH_TYPE))); isIVRoute = Boolean.valueOf(jobProperties.getProperty((BatchConstants.IVROUTE))); isCartesian = Boolean.valueOf(jobProperties.getProperty((BatchConstants.CARTESIAN))); updateLegProcessor = provider.getUpdateLegProcessor(); routerClient = provider.getIVRouterClient(); databaseWorker = initWorker(type); }
@PostConstruct public void init() { try { authenticationManagerBuilder .userDetailsService(userDetailsService) .passwordEncoder(passwordEncoder()); } catch (Exception e) { throw new BeanInitializationException("Security configuration failed", e); } }
@PostConstruct public void init() { getColumnNamesMapping().put(PURCHASE_ORDER_NUMBER, TableColumns.PURCHASE_ORDER_NUMBER); getColumnNamesMapping().put(SERVICE_NAME, TableColumns.SERVICE_NAME); getColumnNamesMapping().put(SUBSCRIPTION_ID, TableColumns.SUBSCRIPTION_ID); getColumnNamesMapping().put(ACTIVATION, TableColumns.ACTIVATION_TIME); getColumnNamesMapping().put(STATUS, TableColumns.STATUS); getSortOrders().put(PURCHASE_ORDER_NUMBER, SortOrder.unsorted); getSortOrders().put(SERVICE_NAME, SortOrder.unsorted); getSortOrders().put(SUBSCRIPTION_ID, SortOrder.unsorted); getSortOrders().put(ACTIVATION, SortOrder.descending); getSortOrders().put(STATUS, SortOrder.unsorted); }
@PostConstruct private void init() { initPickTarget(); Long id = WebUtil.getLongParamValue(GetParamNames.CRITERIA_ID); if (id != null) { this.load(id); } else { loadDefault(); } }
/** * Initialise la vue */ @PostConstruct public void init() { super.init(); setNavigationButton(CandidatInfoPersoView.NAME, CandidatBacView.NAME); /*Edition des donneés d'adresse*/ OneClickButton btnEdit = new OneClickButton(FontAwesome.PENCIL); btnEdit.setCaption(applicationContext.getMessage("adresse.edit.btn", null, UI.getCurrent().getLocale())); btnEdit.addClickListener(e -> { candidatController.editAdresse(cptMin, this); }); addGenericButton(btnEdit, Alignment.MIDDLE_LEFT); noInfoLabel.setValue(applicationContext.getMessage("adresse.noinfo", null, UI.getCurrent().getLocale())); addGenericComponent(noInfoLabel); /*L'adresse*/ table.setSizeFull(); table.setVisibleColumns((Object[]) FIELDS_ORDER); table.setColumnCollapsingAllowed(false); table.setColumnReorderingAllowed(false); table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN); table.setSelectable(false); table.setImmediate(true); table.setColumnWidth(SimpleTablePresentation.CHAMPS_TITLE, 250); table.setCellStyleGenerator((components, itemId, columnId)->{ if (columnId!=null && columnId.equals(SimpleTablePresentation.CHAMPS_TITLE)){ return (ValoTheme.LABEL_BOLD); } return null; }); addGenericComponent(table); setGenericExpandRatio(table); }
@PostConstruct public void init() throws InterruptedException { if (exportClient) { int tries = 0; do { tries++; try { if (isRegistered()) { logger.info("Already registered with export service"); return; } logger.debug("Attempting to register with export service"); if (registerRulesEngine()) { logger.info("Export client registration complete"); return; } } catch (Exception e) { logger.debug("Problem while connecting to export client service: " + e.getMessage()); logger.info("Export Client registration try# : " + tries); } retrySleep(retryTime); } while (tries < retryAttempts); logger.error("Trouble connecting to export service. Exiting.\n"); System.exit(1); } else logger.info("Direct receiver of messages from core. No export client registration"); }
/** * Logs on startup whether a validation url is present */ @PostConstruct public void checkForValidationUrlVariable() { String validationUrl = environment.getProperty(Constants.VALIDATION_URL_ENV_VARIABLE); if (!StringUtils.isEmpty(validationUrl)) { apiLog(Constants.VALIDATION_URL_ENV_VARIABLE + " is set to " + validationUrl); } else { apiLog(Constants.VALIDATION_URL_ENV_VARIABLE + " is unset"); } }
/** * Initializes QualiToast. * <p> * Spring profiles can be configured with a program arguments --spring.profiles.active=your-active-profile * <p> * You can find more information on how profiles work with JHipster on <a href="http://www.jhipster.tech/profiles/">http://www.jhipster.tech/profiles/</a>. */ @PostConstruct public void initApplication() { Collection<String> activeProfiles = Arrays.asList(env.getActiveProfiles()); if (activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) && activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_PRODUCTION)) { log.error("You have misconfigured your application! It should not run " + "with both the 'dev' and 'prod' profiles at the same time."); } if (activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) && activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_CLOUD)) { log.error("You have misconfigured your application! It should not " + "run with both the 'dev' and 'cloud' profiles at the same time."); } }