org.springframework.beans.factory.annotation.Value Java Examples
The following examples show how to use
org.springframework.beans.factory.annotation.Value.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CommonBeans.java From circus-train with Apache License 2.0 | 6 votes |
@Profile({ Modules.REPLICATION }) @Bean Supplier<CloseableMetaStoreClient> replicaMetaStoreClientSupplier( ReplicaCatalog replicaCatalog, @Value("#{replicaHiveConf}") HiveConf replicaHiveConf, ConditionalMetaStoreClientFactoryManager conditionalMetaStoreClientFactoryManager) { String metaStoreUris = replicaCatalog.getHiveMetastoreUris(); if (metaStoreUris == null) { // Default to Thrift is not specified - optional attribute in ReplicaCatalog metaStoreUris = ThriftHiveMetaStoreClientFactory.ACCEPT_PREFIX; } MetaStoreClientFactory replicaMetaStoreClientFactory = conditionalMetaStoreClientFactoryManager .factoryForUri(metaStoreUris); return metaStoreClientSupplier(replicaHiveConf, replicaCatalog.getName(), replicaCatalog.getMetastoreTunnel(), replicaMetaStoreClientFactory); }
Example #2
Source File: ServerConfig.java From graphouse with Apache License 2.0 | 6 votes |
@Bean(initMethod = "startServer") public GraphouseWebServer server( @Value("${graphouse.metric-data.max-metrics-per-query}") int maxMetricsPerQuery, @Value("${graphouse.http.response-buffer-size-bytes}") int responseBufferSizeBytes) { final MetricSearchServlet metricSearchServlet = new MetricSearchServlet( metricSearch, statisticsService ); MonitoringServlet monitoringServlet = new MonitoringServlet(monitoring, ping); MetricDataServiceServlet metricDataServiceServlet = new MetricDataServiceServlet( metricDataService, maxMetricsPerQuery, responseBufferSizeBytes ); return new GraphouseWebServer(metricSearchServlet, monitoringServlet, metricDataServiceServlet); }
Example #3
Source File: RequestMappingHandlerAdapterIntegrationTests.java From java-technology-stack with MIT License | 6 votes |
String handleInInterface( @CookieValue("cookie") int cookieV, @PathVariable("pathvar") String pathvarV, @RequestHeader("header") String headerV, @RequestHeader(defaultValue = "#{systemProperties.systemHeader}") String systemHeader, @RequestHeader Map<String, Object> headerMap, @RequestParam("dateParam") Date dateParam, @RequestParam Map<String, Object> paramMap, String paramByConvention, @Value("#{request.contextPath}") String value, @ModelAttribute("modelAttr") @Valid TestBean modelAttr, Errors errors, TestBean modelAttrByConvention, Color customArg, HttpServletRequest request, HttpServletResponse response, @SessionAttribute TestBean sessionAttribute, @RequestAttribute TestBean requestAttribute, User user, @ModelAttribute OtherUser otherUser, Model model, UriComponentsBuilder builder);
Example #4
Source File: JmsServerConfiguration.java From artemis-disruptor-miaosha with Apache License 2.0 | 6 votes |
@Bean public JmsMessageSender responseMessageSender(@Value("${jms-sender.ring-buffer-size}")int ringBufferSize) throws JMSException { DisruptorJmsMessageSender disruptorJmsMessageSender = DisruptorJmsMessageSenderFactory.create( responseSession(), responseMessageProducer(), new ArtemisMessageDtoDupMessageDetectStrategy(), ringBufferSize ); Disruptor disruptor = disruptorJmsMessageSender.getDisruptor(); BeanRegisterUtils.registerSingleton( applicationContext, "responseMessageSenderLifeCycleContainer", new DisruptorLifeCycleContainer("responseMessageSender", disruptor, Ordered.LOWEST_PRECEDENCE) ); return disruptorJmsMessageSender; }
Example #5
Source File: AuthorizationController.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 6 votes |
/*** * Action to edit or create a teacher category * * @param model * @param category the category to edit. If null it will create a new one * @param form the category information, {@link TeacherCategory#setCode(String)} must be unique. * @return */ @RequestMapping(method = POST, value = "categories/{category}") public String createOrEdit(Model model, @Value("null") @PathVariable TeacherCategory category, @ModelAttribute CategoryBean form) { try { if (category != null) { service.editCategory(category, form); } else { service.createCategory(form); } } catch (Exception e) { model.addAttribute("error", e.getLocalizedMessage()); model.addAttribute("form", form); return view("categories/create"); } return "redirect:/teacher/authorizations/categories"; }
Example #6
Source File: LightminClientProperties.java From spring-batch-lightmin with Apache License 2.0 | 6 votes |
@Autowired public LightminClientProperties(final ManagementServerProperties managementServerProperties, final ServerProperties serverProperties, @Value("${spring.batch.lightmin.application-name:null}") final String name, @Value("${endpoints.health.id:health}") final String healthEndpointId, final WebEndpointProperties webEndpointProperties, final Environment environment) { if (name == null || "null".equals(name)) { this.name = environment.getProperty("spring.application.name", "spring-boot-application"); } else { this.name = name; } this.healthEndpointId = healthEndpointId; this.managementServerProperties = managementServerProperties; this.serverProperties = serverProperties; this.webEndpointProperties = webEndpointProperties; }
Example #7
Source File: RegisterExtensionSpringExtensionTests.java From java-technology-stack with MIT License | 5 votes |
@Test void valueParameterFromDefaultValueForPropertyPlaceholder( @Value("${bogus:false}") Boolean defaultValue) { assertNotNull(defaultValue, "Default value should have been injected via @Value by Spring"); assertEquals(false, defaultValue, "default value"); }
Example #8
Source File: WebClientConfig.java From blog-tutorials with MIT License | 5 votes |
@Bean public WebClient todoWebClient(@Value("${todo_url}") String todoUrl, @Autowired WebClient.Builder webClientBuilder) { return webClientBuilder .clone() .baseUrl(todoUrl) .defaultHeader(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE) .build(); }
Example #9
Source File: SpringRestJobsService.java From kogito-runtimes with Apache License 2.0 | 5 votes |
@Autowired public SpringRestJobsService( @Value("${kogito.jobs-service.url}") String jobServiceUrl, @Value("${kogito.service.url}") String callbackEndpoint, @Autowired(required=false) RestTemplate restTemplate) { super(jobServiceUrl, callbackEndpoint); this.restTemplate = restTemplate; }
Example #10
Source File: TracingConfiguration.java From pivotal-bank-demo with Apache License 2.0 | 5 votes |
/** Configuration for how to buffer spans into messages for Zipkin */ @Bean Reporter<Span> reporter( Sender sender, @Value("${zipkin.self-tracing.message-timeout:1}") int messageTimeout, CollectorMetrics metrics) { return AsyncReporter.builder(sender) .messageTimeout(messageTimeout, TimeUnit.SECONDS) .metrics(new ReporterMetricsAdapter(metrics.forTransport("local"))) .build(); }
Example #11
Source File: PrometheusAutoConfiguration.java From orders with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnMissingBean(name = "prometheusMetricsServletRegistrationBean") ServletRegistrationBean prometheusMetricsServletRegistrationBean(@Value("${prometheus.metrics" + ".path:/metrics}") String metricsPath) { DefaultExports.initialize(); return new ServletRegistrationBean(new MetricsServlet(), metricsPath); }
Example #12
Source File: ZookeeperSettings.java From nakadi with MIT License | 5 votes |
@Autowired public ZookeeperSettings(@Value("${nakadi.zookeeper.sessionTimeoutMs}") final int zkSessionTimeoutMs, @Value("${nakadi.zookeeper.connectionTimeoutMs}")final int zkConnectionTimeoutMs, @Value("${nakadi.zookeeper.maxInFlightRequests}") final int maxInFlightRequests) { this.zkSessionTimeoutMs = zkSessionTimeoutMs; this.zkConnectionTimeoutMs = zkConnectionTimeoutMs; this.maxInFlightRequests = maxInFlightRequests; }
Example #13
Source File: CartRepositoryImpl.java From AppStash with Apache License 2.0 | 5 votes |
@Autowired public CartRepositoryImpl(@Value("${redis.cart.microservice.url}") String baseUrl, RestTemplate restTemplate) { this.restTemplate = restTemplate; CREATE_TEMPLATE = new UriTemplate(baseUrl + CREATE); GET_TEMPLATE = new UriTemplate(baseUrl + GET); ADD_TEMPLATE = new UriTemplate(baseUrl + ADD); REMOVE_TEMPLATE = new UriTemplate(baseUrl + REMOVE); CLEAR_TEMPLATE = new UriTemplate(baseUrl + CLEAR); }
Example #14
Source File: ApplicationRegisterImpl.java From micro-server with Apache License 2.0 | 5 votes |
@Autowired public ApplicationRegisterImpl(@Value("${host.address:#{null}}") String customHostname, @Value("${target.endpoint:#{null}}") String targetEndpoint, @Qualifier("propertyFactory") Properties props) { this.customHostname = customHostname; this.targetEndpoint = targetEndpoint; this.props = props; }
Example #15
Source File: TowtruckApp.java From data-highway with Apache License 2.0 | 5 votes |
@Bean Supplier<String> keySupplier(Clock clock, @Value("${s3.keyPrefix}") String keyPrefix) { return () -> { long millis = clock.millis(); String date = ISODateTimeFormat.date().withZoneUTC().print(millis); String time = ISODateTimeFormat.basicDateTimeNoMillis().withZoneUTC().print(millis); return String.format("%s/%s/%s.json.gz", keyPrefix, date, time); }; }
Example #16
Source File: TimelineCleanupJob.java From nakadi with MIT License | 5 votes |
@Autowired public TimelineCleanupJob(final EventTypeCache eventTypeCache, final TimelineDbRepository timelineDbRepository, final TimelineService timelineService, final FeatureToggleService featureToggleService, final JobWrapperFactory jobWrapperFactory, @Value("${nakadi.jobs.timelineCleanup.runPeriodMs}") final int periodMs, @Value("${nakadi.jobs.timelineCleanup.deletionDelayMs}") final long deletionDelayMs) { this.eventTypeCache = eventTypeCache; this.timelineDbRepository = timelineDbRepository; this.timelineService = timelineService; this.jobWrapper = jobWrapperFactory.createExclusiveJobWrapper(JOB_NAME, periodMs); this.featureToggleService = featureToggleService; this.deletionDelayMs = deletionDelayMs; }
Example #17
Source File: WebConfiguration.java From prebid-server-java with Apache License 2.0 | 5 votes |
@Bean AuctionHandler auctionHandler( ApplicationSettings applicationSettings, BidderCatalog bidderCatalog, PreBidRequestContextFactory preBidRequestContextFactory, CacheService cacheService, Metrics metrics, HttpAdapterConnector httpAdapterConnector, Clock clock, TcfDefinerService tcfDefinerService, PrivacyExtractor privacyExtractor, JacksonMapper mapper, @Value("${gdpr.host-vendor-id:#{null}}") Integer hostVendorId, @Value("${geolocation.enabled}") boolean useGeoLocation) { return new AuctionHandler( applicationSettings, bidderCatalog, preBidRequestContextFactory, cacheService, metrics, httpAdapterConnector, clock, tcfDefinerService, privacyExtractor, mapper, hostVendorId, useGeoLocation); }
Example #18
Source File: TokenService.java From Spring-5.0-By-Example with MIT License | 5 votes |
public TokenService(WebClient webClient, @Value("${auth.service}") String authService, @Value("${auth.path}") String authServiceApiPath, DiscoveryService discoveryService) { this.webClient = webClient; this.authService = authService; this.authServiceApiPath = authServiceApiPath; this.discoveryService = discoveryService; }
Example #19
Source File: SpringJUnitJupiterAutowiredConstructorInjectionTests.java From spring-analysis-note with MIT License | 5 votes |
@Autowired SpringJUnitJupiterAutowiredConstructorInjectionTests(ApplicationContext applicationContext, Person dilbert, Dog dog, @Value("${enigma}") Integer enigma) { this.applicationContext = applicationContext; this.dilbert = dilbert; this.dog = dog; this.enigma = enigma; }
Example #20
Source File: WebController.java From spring-cloud-gcp with Apache License 2.0 | 5 votes |
@Value("${application.ocr-bucket}") public void setOcrBucket(String ocrBucket) { try { this.storage.get(ocrBucket, BucketGetOption.fields()); } catch (Exception e) { throw new IllegalArgumentException( "The bucket " + ocrBucket + " does not exist. " + "Please specify a valid Google Storage bucket name " + "in the resources/application.properties file. " + "You can create a new bucket at: https://console.cloud.google.com/storage"); } this.ocrBucket = ocrBucket; }
Example #21
Source File: ZipkinQueryApiV2.java From pivotal-bank-demo with Apache License 2.0 | 5 votes |
ZipkinQueryApiV2( StorageComponent storage, @Value("${zipkin.storage.type:mem}") String storageType, @Value("${zipkin.query.lookback:86400000}") long defaultLookback, // 1 day in millis @Value("${zipkin.query.names-max-age:300}") int namesMaxAge // 5 minutes ) { this.storage = storage; this.storageType = storageType; this.defaultLookback = defaultLookback; this.namesMaxAge = namesMaxAge; }
Example #22
Source File: MailFeedbackSender.java From data-prep with Apache License 2.0 | 5 votes |
@Autowired public void setPassword(@Value("${mail.smtp.password}") String password) { try { this.password = AESEncryption.decrypt(password); } catch (Exception exc) { LOGGER.debug("Unable to parse given password used to send feedback mails {}", password, exc); } }
Example #23
Source File: PluginsConfig.java From nakadi with MIT License | 5 votes |
@Bean public AuthorizationService authorizationService(@Value("${nakadi.plugins.authz.factory}") final String factoryName, final SystemProperties systemProperties, final DefaultResourceLoader loader) { try { LOGGER.info("Initialize per-resource authorization service factory: " + factoryName); final Class<AuthorizationServiceFactory> factoryClass = (Class<AuthorizationServiceFactory>) loader.getClassLoader().loadClass(factoryName); final AuthorizationServiceFactory factory = factoryClass.newInstance(); return factory.init(systemProperties); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { throw new BeanCreationException("Can't create AuthorizationService " + factoryName, e); } }
Example #24
Source File: LoggingConfiguration.java From tutorials with MIT License | 5 votes |
public LoggingConfiguration(@Value("${spring.application.name}") String appName, @Value("${server.port}") String serverPort, @Value("${info.project.version:}") String version, JHipsterProperties jHipsterProperties) { this.appName = appName; this.serverPort = serverPort; this.version = version; this.jHipsterProperties = jHipsterProperties; if (jHipsterProperties.getLogging().getLogstash().isEnabled()) { addLogstashAppender(context); addContextListener(context); } if (jHipsterProperties.getMetrics().getLogs().isEnabled()) { setMetricsMarkerLogbackFilter(context); } }
Example #25
Source File: Saml20AutoConfiguration.java From MaxKey with Apache License 2.0 | 5 votes |
/** * OpenHTTPPostSimpleSignDecoder. * @return openHTTPPostSimpleSignDecoder */ @Bean(name = "openHTTPPostSimpleSignDecoder") public OpenHTTPPostSimpleSignDecoder openHTTPPostSimpleSignDecoder(BasicParserPool samlParserPool, @Value("${config.saml.v20.idp.receiver.endpoint}") String receiverEndpoint) { OpenHTTPPostSimpleSignDecoder decoder = new OpenHTTPPostSimpleSignDecoder(samlParserPool); decoder.setReceiverEndpoint(receiverEndpoint); return decoder; }
Example #26
Source File: LoggingConfiguration.java From cubeai with Apache License 2.0 | 5 votes |
public LoggingConfiguration(@Value("${spring.application.name}") String appName, @Value("${server.port}") String serverPort, ConsulRegistration consulRegistration, @Value("${info.project.version}") String version, JHipsterProperties jHipsterProperties) { this.appName = appName; this.serverPort = serverPort; this.consulRegistration = consulRegistration; this.version = version; this.jHipsterProperties = jHipsterProperties; if (jHipsterProperties.getLogging().getLogstash().isEnabled()) { addLogstashAppender(context); addContextListener(context); } if (jHipsterProperties.getMetrics().getLogs().isEnabled()) { setMetricsMarkerLogbackFilter(context); } }
Example #27
Source File: ItemReaderWriterConfig.java From batchers with Apache License 2.0 | 5 votes |
@Bean(destroyMethod = "") @StepScope public JpaPagingItemReader<Employee> taxCalculatorItemReaderSlave(@Value("#{stepExecution}") StepExecution stepExecution) { JpaPagingItemReader<Employee> employeeItemReader = new JpaPagingItemReader<>(); employeeItemReader.setEntityManagerFactory(persistenceConfig.entityManagerFactory()); employeeItemReader.setQueryString(TaxCalculation.GET_UNPROCESSED_EMPLOYEES_BY_YEAR_AND_MONTH_QUERY_SLAVE); Map<String, Object> parameters = new HashMap<>(); parameters.put("year", stepExecution.getJobParameters().getLong("year").intValue()); parameters.put("month", stepExecution.getJobParameters().getLong("month").intValue()); parameters.put("jobExecutionId", stepExecution.getJobExecutionId()); parameters.put("minId", stepExecution.getExecutionContext().getLong("minValue")); parameters.put("maxId", stepExecution.getExecutionContext().getLong("maxValue")); employeeItemReader.setParameterValues(parameters); return employeeItemReader; }
Example #28
Source File: S3FileManagerImpl.java From entrada with GNU General Public License v3.0 | 5 votes |
public S3FileManagerImpl(AmazonS3 amazonS3, @Value("${aws.upload.parallelism}") int parallelism, @Value("${aws.upload.multipart.mb.size:5}") int multipartSize) { this.amazonS3 = amazonS3; this.transferManager = TransferManagerBuilder .standard() .withS3Client(amazonS3) .withMultipartUploadThreshold(multipartSize * 1024L * 1024L) .withExecutorFactory(() -> Executors.newFixedThreadPool(parallelism)) .build(); }
Example #29
Source File: ImageProcessingService.java From tensorboot with Apache License 2.0 | 5 votes |
@Autowired public ImageProcessingService(MobilenetV2Classifier classifier, @Value("${tensorboot.maxExecutorsCount}") int maxExecutorsCount, @Value("${tensorboot.previewSize}") int previewSize ) { this.classifier = new PooledClassifier<>(classifier, maxExecutorsCount); this.previewSize = previewSize; }
Example #30
Source File: ExecutorMetadata.java From liteflow with Apache License 2.0 | 5 votes |
/** * 设置executor运行的空间 * @param workspace */ @Value("${lite.flow.executor.workspace}") public void setExecutorWorkspace(String workspace){ if(EXECUTOR_WORKSPACE == null){ EXECUTOR_WORKSPACE = workspace; } }