org.springframework.boot.SpringBootVersion Java Examples
The following examples show how to use
org.springframework.boot.SpringBootVersion.
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: OnSpringBootVersion.java From sofa-ark with Apache License 2.0 | 8 votes |
@Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { Map<String, Object> springBootVersion = metadata .getAnnotationAttributes(ConditionalOnSpringBootVersion.class.getCanonicalName()); if (springBootVersion == null || springBootVersion.get("version") == null) { return new ConditionOutcome(false, "No specified spring boot version."); } ConditionalOnSpringBootVersion.Version version = (ConditionalOnSpringBootVersion.Version) springBootVersion .get("version"); if (ConditionalOnSpringBootVersion.Version.ANY.equals(version)) { return new ConditionOutcome(true, "Conditional on Any Spring Boot."); } else if (ConditionalOnSpringBootVersion.Version.OneX.equals(version)) { if (SpringBootVersion.getVersion().startsWith("1")) { return new ConditionOutcome(true, "Conditional on OneX Spring Boot."); } else { return new ConditionOutcome(false, "Conditional on OneX Spring Boot."); } } else if (ConditionalOnSpringBootVersion.Version.TwoX.equals(version)) { if (SpringBootVersion.getVersion().startsWith("2")) { return new ConditionOutcome(true, "Conditional on TwoX Spring Boot."); } else { return new ConditionOutcome(false, "Conditional on TwoX Spring Boot."); } } throw new IllegalStateException("Error Spring Boot Version."); }
Example #2
Source File: SpringBootBanner.java From oneplatform with Apache License 2.0 | 6 votes |
@Override public void printBanner(Environment environment, Class<?> sourceClass, PrintStream printStream) { for (String line : BANNER) { printStream.println(line); } String version = SpringBootVersion.getVersion(); version = (version == null ? "" : " (v" + version + ")"); String padding = ""; while (padding.length() < STRAP_LINE_SIZE - (version.length() + SPRING_BOOT.length())) { padding += " "; } printStream.println(AnsiOutput.toString(AnsiColor.GREEN, SPRING_BOOT, AnsiColor.DEFAULT, padding, AnsiStyle.FAINT, version)); printStream.println(); }
Example #3
Source File: CentralDogmaAutoConfigurationTest.java From centraldogma with Apache License 2.0 | 6 votes |
/** * When there are no `ClientFactory`s with `ForCentralDogma` qualifier, * the default `ClientFactory` must be used. */ @Test void centralDogmaClient() throws Exception { assertThat(client).isNotNull(); if (SpringBootVersion.getVersion().startsWith("1.")) { // JUnit 5 extension for Spring Boot 1.x has a bug which pulls in a bean from other tests, // so we can't test this properly. final ClientFactory expectedClientFactory = new CentralDogmaClientAutoConfigurationWithClientFactoryTest.TestConfiguration() .dogmaClientFactory(); assertThat(clientFactory).isSameAs(expectedClientFactory); } else { assertThat(clientFactory).isSameAs(ClientFactory.ofDefault()); } }
Example #4
Source File: Analyzer.java From Moss with Apache License 2.0 | 5 votes |
public static JarDependencies getAllPomInfo() throws Exception { JarDependencies jarDependencies = new JarDependencies(); List<PomInfo> pomInfos = getAllJarPomInfo(); jarDependencies.setPomInfos(pomInfos); jarDependencies.setSpringBootVersion(SpringBootVersion.getVersion()); Optional<PomInfo> optionalPomInfo = pomInfos.stream().filter( // x -> (StringUtils.isNotEmpty(x.groupId) && x.groupId.equals("org.springframework.cloud") &&x.artifactId.equals("spring-cloud-commons"))) .findFirst(); setSpringCloudDeps(optionalPomInfo, jarDependencies); return jarDependencies; }
Example #5
Source File: SpringMvcTest.java From bugsnag-java with MIT License | 5 votes |
@Test @SuppressWarnings("unchecked") public void springVersionSetCorrectly() { callRuntimeExceptionEndpoint(); Report report = verifyAndGetReport(delivery); // Check that the Spring version is set as expected Map<String, Object> deviceMetadata = report.getDevice(); Map<String, Object> runtimeVersions = (Map<String, Object>) deviceMetadata.get("runtimeVersions"); assertEquals(SpringVersion.getVersion(), runtimeVersions.get("springFramework")); assertEquals(SpringBootVersion.getVersion(), runtimeVersions.get("springBoot")); }
Example #6
Source File: CompatibilityVerifierAutoConfigurationTests.java From spring-cloud-commons with Apache License 2.0 | 5 votes |
@Test public void verifierPropertiesContainsCurrentBootVersion() { String version = SpringBootVersion.getVersion(); assertThat(version).isNotBlank(); for (String compatibleVersion : verifierProperties.getCompatibleBootVersions()) { if (version.startsWith(stripWildCardFromVersion(compatibleVersion))) { // success we found the current boot version in our list of compatible // versions. return; } } fail(version + " not found in " + verifierProperties.getCompatibleBootVersions()); }
Example #7
Source File: ActorRepositoryIntegrationTest.java From spring-data-examples with Apache License 2.0 | 5 votes |
private static boolean thatSupportForNestedPropertiesIsAvailable() { Version minVersion = Version.parse("2.0.5"); return Optional.ofNullable(SpringBootVersion.getVersion()).map(Version::parse) // .map(v -> v.isGreaterThanOrEqualTo(minVersion)) // .orElseGet(ActorRepositoryIntegrationTest::fallBackToVersionSpecificClasses); }
Example #8
Source File: FlowableLiquibaseEnvironmentPostProcessor.java From flowable-engine with Apache License 2.0 | 5 votes |
protected String getLiquibaseProperty() { String springBootVersion = SpringBootVersion.getVersion(); if (springBootVersion == null || !springBootVersion.startsWith("1")) { return "spring.liquibase.enabled"; } else { return "liquibase.enabled"; } }
Example #9
Source File: RouteToRequestUrlFilterTests.java From spring-cloud-gateway with Apache License 2.0 | 5 votes |
@Test public void partialEncodedParameters() { assumeTrue("partialEncodedParameters ignored for boot 2.2", SpringBootVersion.getVersion().startsWith("2.3.")); URI url = UriComponentsBuilder .fromUriString("http://localhost/get?key[]=test= key&start=1533108081") .build().toUri(); // prove that it is partial encoded assertThat(url.getRawQuery()).isEqualTo("key[]=test=%20key&start=1533108081"); assertThat(url).hasParameter("key[]", "test= key"); assertThat(url).hasParameter("start", "1533108081"); MockServerHttpRequest request = MockServerHttpRequest.method(HttpMethod.GET, url) .build(); ServerWebExchange webExchange = testFilter(request, "http://myhost"); URI uri = webExchange.getRequiredAttribute(GATEWAY_REQUEST_URL_ATTR); assertThat(uri).hasScheme("http").hasHost("myhost") // since https://github.com/joel-costigliola/assertj-core/issues/1699 // assertj uses raw query .hasParameter("key[]", "test=%20key").hasParameter("start", "1533108081"); // prove that it is double encoded since partial encoded uri is treated as // unencoded. assertThat(uri.getRawQuery()).isEqualTo("key[]=test=%2520key&start=1533108081"); }
Example #10
Source File: AbastractJboneBanner.java From jbone with Apache License 2.0 | 5 votes |
/** * 收集环境信息,包括Java、操作系统等 * * @param environment 当前运行环境 * @param sourceClass 启动类 * @return 环境信息 */ private String collectEnvironmentInfo(final Environment environment, final Class<?> sourceClass) { final Properties properties = System.getProperties(); try (Formatter formatter = new Formatter()) { formatter.format("Spring Boot Version: %s%n", SpringBootVersion.getVersion()); formatter.format("%s%n", LINE_SEPARATOR); formatter.format("Java Home: %s%n", properties.get("java.home")); formatter.format("Java Vendor: %s%n", properties.get("java.vendor")); formatter.format("Java Version: %s%n", properties.get("java.version")); final Runtime runtime = Runtime.getRuntime(); formatter.format("JVM Free Memory: %s%n", FileUtils.byteCountToDisplaySize(runtime.freeMemory())); formatter.format("JVM Maximum Memory: %s%n", FileUtils.byteCountToDisplaySize(runtime.maxMemory())); formatter.format("JVM Total Memory: %s%n", FileUtils.byteCountToDisplaySize(runtime.totalMemory())); formatter.format("JCE Installed: %s%n", StringUtils.capitalize(BooleanUtils.toStringYesNo(isJceInstalled()))); formatter.format("%s%n", LINE_SEPARATOR); formatter.format("OS Architecture: %s%n", properties.get("os.arch")); formatter.format("OS Name: %s%n", properties.get("os.name")); formatter.format("OS Version: %s%n", properties.get("os.version")); formatter.format("OS Date/Time: %s%n", LocalDateTime.now()); formatter.format("OS Temp Directory: %s%n", FileUtils.getTempDirectoryPath()); formatter.format("%s%n", LINE_SEPARATOR); injectEnvironmentInfoIntoBanner(formatter, environment, sourceClass); return formatter.toString(); } }
Example #11
Source File: RuoYiApplication.java From RuoYi with Apache License 2.0 | 4 votes |
public static void main(String[] args) { Instant inst1 = Instant.now(); SpringApplication.run(RuoYiApplication.class, args); log.info(":: 若依管理系统Java开发平台 :: 基于 Spring Boot {} ::", SpringBootVersion.getVersion()); log.info(":: 启动成功!耗时:{}秒 ::", Duration.between(inst1, Instant.now()).getSeconds()); }
Example #12
Source File: SpringDataReleaseCliBannerProvider.java From spring-data-dev-tools with Apache License 2.0 | 4 votes |
@Override public String getVersion() { return "1.0 on Spring Boot " + SpringBootVersion.getVersion(); }
Example #13
Source File: ArkApplicationStartListener.java From sofa-ark with Apache License 2.0 | 4 votes |
public boolean isSpringBoot2() { return SpringBootVersion.getVersion().startsWith("2"); }
Example #14
Source File: SpringBootVersionVerifier.java From spring-cloud-commons with Apache License 2.0 | 4 votes |
String getVersionFromManifest() { return SpringBootVersion.getVersion(); }
Example #15
Source File: ArkApplicationStartListener.java From sofa-ark with Apache License 2.0 | 4 votes |
public boolean isSpringBoot1() { return SpringBootVersion.getVersion().startsWith("1"); }
Example #16
Source File: SpringBootConfiguration.java From bugsnag-java with MIT License | 4 votes |
private void addSpringRuntimeVersion(Map<String, Object> device) { Diagnostics.addDeviceRuntimeVersion(device, "springBoot", SpringBootVersion.getVersion()); }
Example #17
Source File: AdminEndPointConfiguration.java From Moss with Apache License 2.0 | 4 votes |
@Bean public SimpleInfoContributor springBootVersionInfoContributor() { return new SimpleInfoContributor("spring-boot-version", SpringBootVersion.getVersion()); }
Example #18
Source File: MgmtConfig.java From secrets-proxy with Apache License 2.0 | 2 votes |
/** * Contribute SpringBoot version to "/info". * * @return {@link InfoContributor} */ @Bean public InfoContributor versionInfo() { return builder -> builder.withDetail("spring-boot.version", SpringBootVersion.getVersion()); }