org.springframework.boot.info.BuildProperties Java Examples
The following examples show how to use
org.springframework.boot.info.BuildProperties.
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: LoggingConfiguration.java From java-microservices-examples with Apache License 2.0 | 6 votes |
public LoggingConfiguration(@Value("${spring.application.name}") String appName, @Value("${server.port}") String serverPort, Optional<BuildProperties> buildProperties, JHipsterProperties jHipsterProperties) { this.appName = appName; this.serverPort = serverPort; this.version = buildProperties.isPresent() ? buildProperties.get().getVersion() : ""; this.jHipsterProperties = jHipsterProperties; if (this.jHipsterProperties.getLogging().isUseJsonFormat()) { addJsonConsoleAppender(context); } if (this.jHipsterProperties.getLogging().getLogstash().isEnabled()) { addLogstashTcpSocketAppender(context); } if (this.jHipsterProperties.getLogging().isUseJsonFormat() || this.jHipsterProperties.getLogging().getLogstash().isEnabled()) { addContextListener(context); } if (this.jHipsterProperties.getMetrics().getLogs().isEnabled()) { setMetricsMarkerLogbackFilter(context); } }
Example #2
Source File: PrefixedKeyGenerator.java From jhipster with Apache License 2.0 | 6 votes |
private String generatePrefix(GitProperties gitProperties, BuildProperties buildProperties) { String shortCommitId = null; if (Objects.nonNull(gitProperties)) { shortCommitId = gitProperties.getShortCommitId(); } Instant time = null; String version = null; if (Objects.nonNull(buildProperties)) { time = buildProperties.getTime(); version = buildProperties.getVersion(); } Object p = ObjectUtils.firstNonNull(shortCommitId, time, version, RandomStringUtils.randomAlphanumeric(12)); if (p instanceof Instant) { return DateTimeFormatter.ISO_INSTANT.format((Instant) p); } return p.toString(); }
Example #3
Source File: KmsService.java From cerberus with Apache License 2.0 | 6 votes |
@Autowired public KmsService( AwsIamRoleDao awsIamRoleDao, UuidSupplier uuidSupplier, KmsClientFactory kmsClientFactory, KmsPolicyService kmsPolicyService, DateTimeSupplier dateTimeSupplier, AwsIamRoleArnParser awsIamRoleArnParser, @Value("${cerberus.auth.kms.policy.validation.interval.millis:300000}") int kmsKeyPolicyValidationInterval, @Value("${cerberus.environmentName}") String environmentName, Slugger slugger, BuildProperties buildProperties) { this.awsIamRoleDao = awsIamRoleDao; this.uuidSupplier = uuidSupplier; this.kmsClientFactory = kmsClientFactory; this.kmsPolicyService = kmsPolicyService; this.dateTimeSupplier = dateTimeSupplier; this.awsIamRoleArnParser = awsIamRoleArnParser; this.kmsKeyPolicyValidationInterval = kmsKeyPolicyValidationInterval; this.environmentName = environmentName; this.slugger = slugger; this.buildProperties = buildProperties; }
Example #4
Source File: LoggingConfiguration.java From java-microservices-examples with Apache License 2.0 | 6 votes |
public LoggingConfiguration(@Value("${spring.application.name}") String appName, @Value("${server.port}") String serverPort, Optional<BuildProperties> buildProperties, JHipsterProperties jHipsterProperties) { this.appName = appName; this.serverPort = serverPort; this.version = buildProperties.isPresent() ? buildProperties.get().getVersion() : ""; this.jHipsterProperties = jHipsterProperties; if (this.jHipsterProperties.getLogging().isUseJsonFormat()) { addJsonConsoleAppender(context); } if (this.jHipsterProperties.getLogging().getLogstash().isEnabled()) { addLogstashTcpSocketAppender(context); } if (this.jHipsterProperties.getLogging().isUseJsonFormat() || this.jHipsterProperties.getLogging().getLogstash().isEnabled()) { addContextListener(context); } if (this.jHipsterProperties.getMetrics().getLogs().isEnabled()) { setMetricsMarkerLogbackFilter(context); } }
Example #5
Source File: LoggingConfiguration.java From java-microservices-examples with Apache License 2.0 | 6 votes |
public LoggingConfiguration(@Value("${spring.application.name}") String appName, @Value("${server.port}") String serverPort, Optional<BuildProperties> buildProperties, JHipsterProperties jHipsterProperties) { this.appName = appName; this.serverPort = serverPort; this.version = buildProperties.isPresent() ? buildProperties.get().getVersion() : ""; this.jHipsterProperties = jHipsterProperties; if (this.jHipsterProperties.getLogging().isUseJsonFormat()) { addJsonConsoleAppender(context); } if (this.jHipsterProperties.getLogging().getLogstash().isEnabled()) { addLogstashTcpSocketAppender(context); } if (this.jHipsterProperties.getLogging().isUseJsonFormat() || this.jHipsterProperties.getLogging().getLogstash().isEnabled()) { addContextListener(context); } if (this.jHipsterProperties.getMetrics().getLogs().isEnabled()) { setMetricsMarkerLogbackFilter(context); } }
Example #6
Source File: MenuTemplate.java From radman with MIT License | 6 votes |
public MenuTemplate(BuildProperties buildProperties) { getModel().setVersion(buildProperties.getVersion()); addCategoryName("RadMan"); addNavigation(UsersView.class, "Users"); addNavigation(UserGroupsView.class, "User groups"); addNavigation(AttributesView.class, "Attributes"); addSeparator(); addCategoryName("Radius"); addNavigation(NasView.class, "NAS"); addNavigation(NasGroupsView.class, "NAS groups"); addNavigation(AuthView.class, "Auth (AA)"); addNavigation(AccountingView.class, "Accounting"); addNavigation(UserToGroupView.class, "User/Group"); addSeparator(); addCategoryName("System"); addNavigation(SystemUsersView.class, "System users"); }
Example #7
Source File: AuditLoggingFilter.java From cerberus with Apache License 2.0 | 5 votes |
@Autowired public AuditLoggingFilter( SdbAccessRequest sdbAccessRequest, AuditLoggingFilterDetails auditLoggingFilterDetails, BuildProperties buildProperties, ApplicationEventPublisher applicationEventPublisher) { this.sdbAccessRequest = sdbAccessRequest; this.auditLoggingFilterDetails = auditLoggingFilterDetails; this.buildProperties = buildProperties; this.applicationEventPublisher = applicationEventPublisher; }
Example #8
Source File: KmsServiceTest.java From cerberus with Apache License 2.0 | 5 votes |
@Before public void setup() { awsIamRoleDao = mock(AwsIamRoleDao.class); uuidSupplier = mock(UuidSupplier.class); kmsClientFactory = mock(KmsClientFactory.class); kmsPolicyService = mock(KmsPolicyService.class); dateTimeSupplier = mock(DateTimeSupplier.class); slugger = new Slugger(); var props = new Properties(); props.setProperty("artifact", ARTIFACT); props.setProperty("version", VERSION); var buildProps = new BuildProperties(props); kmsService = new KmsService( awsIamRoleDao, uuidSupplier, kmsClientFactory, kmsPolicyService, dateTimeSupplier, new AwsIamRoleArnParser(), 3000, ENV, slugger, buildProps); }
Example #9
Source File: LoggingConfiguration.java From jhipster-registry with Apache License 2.0 | 5 votes |
public LoggingConfiguration(@Value("${spring.application.name}") String appName, @Value("${server.port}") String serverPort, JHipsterProperties jHipsterProperties, ObjectProvider<BuildProperties> buildProperties, ObjectMapper mapper) throws JsonProcessingException { LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); Map<String, String> map = new HashMap<>(); map.put("app_name", appName); map.put("app_port", serverPort); buildProperties.ifAvailable(it -> map.put("version", it.getVersion())); String customFields = mapper.writeValueAsString(map); JHipsterProperties.Logging loggingProperties = jHipsterProperties.getLogging(); JHipsterProperties.Logging.Logstash logstashProperties = loggingProperties.getLogstash(); if (loggingProperties.isUseJsonFormat()) { addJsonConsoleAppender(context, customFields); } if (logstashProperties.isEnabled()) { addLogstashTcpSocketAppender(context, customFields, logstashProperties); } if (loggingProperties.isUseJsonFormat() || logstashProperties.isEnabled()) { addContextListener(context, customFields, loggingProperties); } if (jHipsterProperties.getMetrics().getLogs().isEnabled()) { setMetricsMarkerLogbackFilter(context, loggingProperties.isUseJsonFormat()); } }
Example #10
Source File: SystemInfoService.java From fredbet with Creative Commons Attribution Share Alike 4.0 International | 5 votes |
@Autowired public SystemInfoService(BuildProperties buildProperties, Environment environment, Optional<GitProperties> gitProperties) { this.buildProperties = buildProperties; this.environment = environment; this.gitProperties = gitProperties; addStaticProperties(); }
Example #11
Source File: AuthTestConfig.java From feast with Apache License 2.0 | 4 votes |
@Bean public BuildProperties buildProperties() { Properties props = new Properties(); props.put("version", "test"); return new BuildProperties(props); }
Example #12
Source File: AboutController.java From egeria with Apache License 2.0 | 4 votes |
@GetMapping public BuildProperties getBuildProperties(HttpServletRequest request) throws HttpClientErrorException { return buildProperties; }
Example #13
Source File: PrefixedKeyGeneratorTest.java From jhipster with Apache License 2.0 | 3 votes |
@Test public void generatePrefixFromBuildVersion() { Properties buildProperties = new Properties(); buildProperties.put("version", "1.0.0"); PrefixedKeyGenerator prefixedKeyGenerator = new PrefixedKeyGenerator(null, new BuildProperties(buildProperties)); assertThat(prefixedKeyGenerator.getPrefix()).isEqualTo("1.0.0"); }
Example #14
Source File: PrefixedKeyGeneratorTest.java From jhipster with Apache License 2.0 | 3 votes |
@Test public void generatePrefixFromBuildTime() { Properties buildProperties = new Properties(); buildProperties.put("time", "1583955265"); PrefixedKeyGenerator prefixedKeyGenerator = new PrefixedKeyGenerator(null, new BuildProperties(buildProperties)); assertThat(prefixedKeyGenerator.getPrefix()).isEqualTo("1970-01-19T07:59:15.265Z"); }
Example #15
Source File: FeastProperties.java From feast with Apache License 2.0 | 2 votes |
/** * Instantiates a new Feast Serving properties. * * @param buildProperties the build properties */ @Autowired public FeastProperties(BuildProperties buildProperties) { setVersion(buildProperties.getVersion()); }
Example #16
Source File: FeastProperties.java From feast with Apache License 2.0 | 2 votes |
/** * Instantiates a new Feast properties. * * @param buildProperties Feast build properties */ @Autowired public FeastProperties(BuildProperties buildProperties) { setVersion(buildProperties.getVersion()); }
Example #17
Source File: BuildInfoMapper.java From holdmail with Apache License 2.0 | 2 votes |
public BuildInfo fromProperties(BuildProperties properties) { return new BuildInfo(properties.getVersion(), properties.getTime()); }
Example #18
Source File: PrefixedKeyGenerator.java From jhipster with Apache License 2.0 | 2 votes |
public PrefixedKeyGenerator(GitProperties gitProperties, BuildProperties buildProperties) { this.prefix = generatePrefix(gitProperties, buildProperties); }