Java Code Examples for javax.annotation.PostConstruct

The following are top voted examples for showing how to use javax.annotation.PostConstruct. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: apollo-custom   File: CtripEmailRequestBuilder.java   Source Code and License 6 votes vote down vote up
@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);
  }
}
 
Example 2
Project: buenojo   File: Application.java   Source Code and License 6 votes vote down vote up
/**
 * 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.");
        }
    }
}
 
Example 3
Project: flow-platform   File: SyncServiceImpl.java   Source Code and License 6 votes vote down vote up
@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());
        }
    });
}
 
Example 4
Project: DiscordConvenienceBot   File: HeroesLibrary.java   Source Code and License 6 votes vote down vote up
@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);
		}
	}
}
 
Example 5
Project: biblebot   File: QueryParserService.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 6
Project: iotplatform   File: MsgProducer.java   Source Code and License 6 votes vote down vote up
@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....");
}
 
Example 7
Project: dooo   File: AbstractIpAgentCallable.java   Source Code and License 6 votes vote down vote up
@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)));
            }
        }
    });
}
 
Example 8
Project: buenojo   File: MultipleChoiceSubjectSpecificResourceIntTest.java   Source Code and License 5 votes vote down vote up
@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();
}
 
Example 9
Project: Persephone   File: ApplicationsPage.java   Source Code and License 5 votes vote down vote up
@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));
}
 
Example 10
Project: yggdrasil-mock   File: YggdrasilDatabase.java   Source Code and License 5 votes vote down vote up
@PostConstruct
private void buildDatabase() {
	users.forEach(user -> {
		try {
			processUser(user);
		} catch (IllegalArgumentException e) {
			throw new IllegalArgumentException("error while processing user " + user.email, e);
		}
	});
}
 
Example 11
Project: sig-seguimiento-vehiculos   File: LayerEditDialog.java   Source Code and License 5 votes vote down vote up
@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();
}
 
Example 12
Project: camunda-task-dispatcher   File: ExternalTaskRestServiceImpl.java   Source Code and License 5 votes vote down vote up
@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();
}
 
Example 13
Project: microservice-atom   File: ItemTestDataGenerator.java   Source Code and License 5 votes vote down vote up
@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));
}
 
Example 14
Project: Architecting-Modern-Java-EE-Applications   File: OrderEventHandler.java   Source Code and License 5 votes vote down vote up
@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);
}
 
Example 15
Project: xm-ms-entity   File: MetricsConfiguration.java   Source Code and License 5 votes vote down vote up
@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);
    }
}
 
Example 16
Project: JBoss-Developers-Guide   File: MoneyTransfertService.java   Source Code and License 5 votes vote down vote up
@PostConstruct
public void init(){
	System.out.println("MoneyTransfertService.init()");
	if(emf== null || !emf.isOpen()){
		emf=Persistence.createEntityManagerFactory("beosbank-mt-unit");
	}
	em=emf.createEntityManager();
}
 
Example 17
Project: JuniperBotJ   File: WikiFurService.java   Source Code and License 5 votes vote down vote up
@PostConstruct
public void init() {
    HttpActionClient httpActionClient = HttpActionClient.builder()
            .withUrl(SCRIPT_ENDPOINT)
            .withUserAgent("JuniperBot", version, "[email protected]")
            .build();
    client = new MediaWikiBot(httpActionClient);
}
 
Example 18
Project: id_center   File: ZKSnowflakeIDGenerator.java   Source Code and License 5 votes vote down vote up
@PostConstruct
public void init() throws Exception {
    // 监听连接状态
    zkManager.addConnectionStateListener(stateListener);
    // 生成初始集群机器ID
    rebuildDatacenterId();
    isWorking = true;
    log.info("idGenerator is isWorking!");
}
 
Example 19
Project: id_center   File: ZkManager.java   Source Code and License 5 votes vote down vote up
/**
 * 创建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!!");
    }
}
 
Example 20
Project: codemotion-2017-taller-de-jhipster   File: CodemotionApp.java   Source Code and License 5 votes vote down vote up
/**
 * 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.");
    }
}
 
Example 21
Project: oscm   File: UserSubscriptionsLazyDataModel.java   Source Code and License 5 votes vote down vote up
@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);
}
 
Example 22
Project: sig-seguimiento-vehiculos   File: MeasureTool.java   Source Code and License 5 votes vote down vote up
@PostConstruct
private void initialize() {
	measure = mapControlFactory.createMesaureControl();
	measure.addMeasureListener(getMeasureListener());
	measure.addMeasurePartialListener(getPartialListener());
	add(measure);
}
 
Example 23
Project: springboot-shiro-cas-mybatis   File: MyShiroCasRealm.java   Source Code and License 5 votes vote down vote up
@PostConstruct
    public void initProperty(){
//      setDefaultRoles("ROLE_USER");
        setCasServerUrlPrefix(ShiroCasConfiguration.casServerUrlPrefix);
        // 客户端回调地址
        setCasService(ShiroCasConfiguration.shiroServerUrlPrefix + ShiroCasConfiguration.casFilterUrlPattern);
    }
 
Example 24
Project: vertx_spring   File: VertxSpringApplication.java   Source Code and License 5 votes vote down vote up
@PostConstruct
public void deployVerticles() {
	doWithConfiguration(config -> {
		vertx.deployVerticle(serviceVerticle, new DeploymentOptions().setConfig(config));
		vertx.deployVerticle(restVerticle, new DeploymentOptions().setConfig(config));
	});
}
 
Example 25
Project: JuniperBotJ   File: BlurImageController.java   Source Code and License 5 votes vote down vote up
@PostConstruct
public void init() {
    blurFilter = new BoxBlurFilter(75);
    try {
        getCache();
    } catch (IOException e) {
        LOGGER.error("Could not create blur cache folder", e);
    }
}
 
Example 26
Project: NGB-master   File: FileManager.java   Source Code and License 5 votes vote down vote up
/**
 * 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));
}
 
Example 27
Project: ctsms   File: DiagnosisBean.java   Source Code and License 5 votes vote down vote up
@PostConstruct
private void init() {
	Long id = WebUtil.getLongParamValue(GetParamNames.DIAGNOSIS_ID);
	if (id != null) {
		this.load(id);
	} else {
		initIn();
		initSets();
	}
}
 
Example 28
Project: visitormanagement   File: ConfigurationService.java   Source Code and License 5 votes vote down vote up
@PostConstruct
public void init() throws InvalidDataException {
	if (configurationRepository.count() > 0) {
		loadConfiguration();
	} else {
		loadAndUpdateDbConfiguration();
	}
	logger.info("Configuration Service", toString());
}
 
Example 29
Project: MicroServiceProject   File: Application.java   Source Code and License 5 votes vote down vote up
@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());
}
 
Example 30
Project: oscm   File: PasswordRecoveryCtrl.java   Source Code and License 5 votes vote down vote up
@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);
}
 
Example 31
Project: oneops   File: SlackConfig.java   Source Code and License 5 votes vote down vote up
@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());
}
 
Example 32
Project: xsharing-services-router   File: MatrixRequestBatchlet.java   Source Code and License 5 votes vote down vote up
@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);
}
 
Example 33
Project: Code4Health-Platform   File: SecurityConfiguration.java   Source Code and License 5 votes vote down vote up
@PostConstruct
public void init() {
    try {
        authenticationManagerBuilder
            .userDetailsService(userDetailsService)
                .passwordEncoder(passwordEncoder());
    } catch (Exception e) {
        throw new BeanInitializationException("Security configuration failed", e);
    }
}
 
Example 34
Project: oscm   File: MySubscriptionsLazyDataModel.java   Source Code and License 5 votes vote down vote up
@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);
}
 
Example 35
Project: ctsms   File: CourseSearchBean.java   Source Code and License 5 votes vote down vote up
@PostConstruct
private void init() {
	initPickTarget();
	Long id = WebUtil.getLongParamValue(GetParamNames.CRITERIA_ID);
	if (id != null) {
		this.load(id);
	} else {
		loadDefault();
	}
}
 
Example 36
Project: esup-ecandidat   File: CandidatAdresseView.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
}
 
Example 37
Project: support-rulesengine   File: ExportClientImpl.java   Source Code and License 5 votes vote down vote up
@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");
}
 
Example 38
Project: qpp-conversion-tool   File: ValidationServiceImpl.java   Source Code and License 5 votes vote down vote up
/**
 * 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");
	}
}
 
Example 39
Project: qualitoast   File: QualiToastApp.java   Source Code and License 5 votes vote down vote up
/**
 * 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.");
    }
}
 
Example 40
Project: scanning   File: DeviceServlet.java   Source Code and License 5 votes vote down vote up
@Override
@PostConstruct  // Requires spring 3 or better
   public void connect() throws EventException, URISyntaxException {
	responder = eventService.createResponder(new URI(broker), requestTopic, responseTopic);
	responder.setBeanClass(DeviceRequest.class);
	responder.setResponseCreator(createResponseCreator());
logger.info("Started "+getClass().getSimpleName()+" using bean "+responder.getBeanClass());
}
 
Example 41
Project: OperatieBRP   File: VerzendingVerwerkVrijBerichtWebServiceClientImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Initialiseert ws client voor vrij bericht.
 */
@PostConstruct
public void initWebServiceClient() {
    webserviceClient = initService().createDispatch(VRIJBERICHT_PORT_NAME, Source.class, Service.Mode.PAYLOAD);
    // future calls to getRequestContext() will use a thread local request context, allowing the request context to be threadsafe.
    webserviceClient.getRequestContext().put("thread.local.request.context", Boolean.TRUE.toString().toLowerCase());
}
 
Example 42
Project: buenojo   File: HangManExerciseOptionResourceIntTest.java   Source Code and License 5 votes vote down vote up
@PostConstruct
public void setup() {
    MockitoAnnotations.initMocks(this);
    HangManExerciseOptionResource hangManExerciseOptionResource = new HangManExerciseOptionResource();
    ReflectionTestUtils.setField(hangManExerciseOptionResource, "hangManExerciseOptionRepository", hangManExerciseOptionRepository);
    this.restHangManExerciseOptionMockMvc = MockMvcBuilders.standaloneSetup(hangManExerciseOptionResource)
        .setCustomArgumentResolvers(pageableArgumentResolver)
        .setMessageConverters(jacksonMessageConverter).build();
}
 
Example 43
Project: testee.fi   File: TestInterceptor.java   Source Code and License 5 votes vote down vote up
@PostConstruct
public Object logPostConstruct(final InvocationContext invocationContext) throws Exception {

    LOG.info("PostConstruct: {} {}", invocationContext.getTarget(), invocationContext.getMethod());
    INVOCATIONS.add(new Invocation(invocationContext.getTarget(), invocationContext.getMethod(), POST_CONSTRUCT));
    return invocationContext.proceed();
}
 
Example 44
Project: spring-boot-multidatasource   File: DataSourceInitializer.java   Source Code and License 5 votes vote down vote up
@PostConstruct
public void init() {
	if (!this.properties.isInitialize()) {
		logger.debug("Initialization disabled (not running DDL scripts)");
		return;
	}
	if (this.applicationContext.containsBean(dataSourceIds[index])) {
		this.dataSource = (DataSource) this.applicationContext.getBean(dataSourceIds[index]);
	}
	if (this.dataSource == null) {
		logger.debug("No DataSource found so not initializing");
		return;
	}
	runSchemaScripts();
}
 
Example 45
Project: oscm   File: TemplateBean.java   Source Code and License 5 votes vote down vote up
@PostConstruct
public void init() {
    LOGGER.info("Initialize template bean");

    Locale currentLocale = getContext().getViewRoot().getLocale();
    this.locale = currentLocale.getLanguage();

    load();
}
 
Example 46
Project: JRockets   File: AggregatorExecutor.java   Source Code and License 4 votes vote down vote up
@PostConstruct
//TODO: Disable postConstructor in integration testing.
    public void start(){
        logger.info("Start data aggregation from Reddit API ");
        ExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
        executorService.execute(aggregator);
    }
 
Example 47
Project: apollo-custom   File: AbstractBaseIntegrationTest.java   Source Code and License 4 votes vote down vote up
@PostConstruct
private void postConstruct() {
  restTemplate.setErrorHandler(new DefaultResponseErrorHandler());
}
 
Example 48
Project: training-sample   File: ExampleBean.java   Source Code and License 4 votes vote down vote up
@PostConstruct
public void annotationInit() {
	System.out.println("annotation init");
}
 
Example 49
Project: ctsms   File: ProbandVisitScheduleBean.java   Source Code and License 4 votes vote down vote up
@PostConstruct
private void init() {
	initIn();
	initSets();
}
 
Example 50
Project: acmeair   File: AcmeAirApp.java   Source Code and License 4 votes vote down vote up
@PostConstruct
public void init() {
    // The init method is called
    register(ProblemInjectFilter.class);
    configureSwagger();
}
 
Example 51
Project: springboot-shiro-cas-mybatis   File: DefaultServicesManagerImpl.java   Source Code and License 4 votes vote down vote up
/**
 * 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);
    }
}
 
Example 52
Project: beadledom   File: FauxModule.java   Source Code and License 4 votes vote down vote up
@PostConstruct
public void postConstruct() {
  System.out.println("**************FauxLifecycleHook postConstruct");
}
 
Example 53
Project: CityPower-Build-Sample   File: ApplicationConfig.java   Source Code and License 4 votes vote down vote up
@PostConstruct
protected void postConstruct() throws IOException {
    LOG.info(applicationProperties.toString());
    LOG.info(azureStorageAccountProperties.toString());
}
 
Example 54
Project: ctsms   File: TrialAssociationBean.java   Source Code and License 4 votes vote down vote up
@PostConstruct
private void init() {
	initIn();
	initSets();
}
 
Example 55
Project: sig-seguimiento-vehiculos   File: LayerInfoToolBar.java   Source Code and License 4 votes vote down vote up
@PostConstruct
private void initialize(){		
	setWidget(verticalGroup);
}
 
Example 56
Project: xray   File: RunawaySensor.java   Source Code and License 4 votes vote down vote up
@PostConstruct
private void init() {
	this.loadExtensionGroups();
}
 
Example 57
Project: jsr375-extensions   File: ViewBean.java   Source Code and License 4 votes vote down vote up
@PostConstruct
public void init() {
    user = (OAuth2User) securityContext.getCallerPrincipal();
}
 
Example 58
Project: microservices-tcc-alfa   File: ClienteService.java   Source Code and License 4 votes vote down vote up
@PostConstruct
void init() {
	cargaCliente.realizarCargaArquivo();
}
 
Example 59
Project: mensa-api   File: JobScheduler.java   Source Code and License 4 votes vote down vote up
@PostConstruct
public void exportOnStartup() {
	if (config.isExportOnStartup()) {
		runExportJobs();
	}
}
 
Example 60
Project: jersey-jwt   File: EntityManagerProducer.java   Source Code and License 4 votes vote down vote up
@PostConstruct
public void init() {
    factory = Persistence.createEntityManagerFactory("default");
}