本文整理汇总了Java中org.springframework.core.SpringVersion类的典型用法代码示例。如果您正苦于以下问题:Java SpringVersion类的具体用法?Java SpringVersion怎么用?Java SpringVersion使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SpringVersion类属于org.springframework.core包,在下文中一共展示了SpringVersion类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPluginContextAttributes
import org.springframework.core.SpringVersion; //导入依赖的package包/类
protected Map<String, Object> createPluginContextAttributes() {
Map<String, Object> attributes = new HashMap<String, Object>();
String bootVersion = CrshAutoConfiguration.class.getPackage()
.getImplementationVersion();
if (bootVersion != null) {
attributes.put("spring.boot.version", bootVersion);
}
attributes.put("spring.version", SpringVersion.getVersion());
if (this.beanFactory != null) {
attributes.put("spring.beanfactory", this.beanFactory);
}
if (this.environment != null) {
attributes.put("spring.environment", this.environment);
}
return attributes;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:17,代码来源:CrshAutoConfiguration.java
示例2: RuntimeEnvironmentInfo
import org.springframework.core.SpringVersion; //导入依赖的package包/类
private RuntimeEnvironmentInfo(Class spiClass, String implementationName, String implementationVersion,
String platformType, String platformApiVersion, String platformClientVersion,
String platformHostVersion, Map<String, String> platformSpecificInfo) {
Assert.notNull(spiClass, "spiClass is required");
Assert.notNull(implementationName, "implementationName is required");
Assert.notNull(implementationVersion, "implementationVersion is required");
Assert.notNull(platformType, "platformType is required");
Assert.notNull(platformApiVersion, "platformApiVersion is required");
Assert.notNull(platformClientVersion, "platformClientVersion is required");
Assert.notNull(platformHostVersion, "platformHostVersion is required");
this.spiVersion = RuntimeVersionUtils.getVersion(spiClass);
this.implementationName = implementationName;
this.implementationVersion = implementationVersion;
this.platformType = platformType;
this.platformApiVersion = platformApiVersion;
this.platformClientVersion = platformClientVersion;
this.platformHostVersion = platformHostVersion;
this.javaVersion = System.getProperty("java.version");
this.springVersion = SpringVersion.getVersion();
this.springBootVersion = RuntimeVersionUtils.getSpringBootVersion();
this.platformSpecificInfo.putAll(platformSpecificInfo);
}
示例3: testCreatingRuntimeEnvironmentInfo
import org.springframework.core.SpringVersion; //导入依赖的package包/类
@Test
public void testCreatingRuntimeEnvironmentInfo() {
RuntimeEnvironmentInfo rei = new RuntimeEnvironmentInfo.Builder()
.spiClass(AppDeployer.class)
.implementationName("TestDeployer")
.implementationVersion("1.0.0")
.platformClientVersion("1.2.0")
.platformHostVersion("1.1.0")
.platformType("Test")
.platformApiVersion("1")
.addPlatformSpecificInfo("foo", "bar")
.build();
assertThat(rei.getSpiVersion(), is(RuntimeVersionUtils.getVersion(AppDeployer.class)));
assertThat(rei.getImplementationName(), is("TestDeployer"));
assertThat(rei.getImplementationVersion(), is("1.0.0"));
assertThat(rei.getPlatformType(), is("Test"));
assertThat(rei.getPlatformApiVersion(), is("1"));
assertThat(rei.getPlatformClientVersion(), is("1.2.0"));
assertThat(rei.getPlatformHostVersion(), is("1.1.0"));
assertThat(rei.getJavaVersion(), is(System.getProperty("java.version")));
assertThat(rei.getSpringVersion(), is(SpringVersion.getVersion()));
assertThat(rei.getSpringBootVersion(), is(RuntimeVersionUtils.getSpringBootVersion()));
assertThat(rei.getPlatformSpecificInfo().get("foo"), is("bar"));
}
示例4: initialize
import org.springframework.core.SpringVersion; //导入依赖的package包/类
@Override
public void initialize(TelemetryContext telemetryContext) {
RelaxedPropertyResolver relaxedPropertyResolver = new RelaxedPropertyResolver(environment);
telemetryContext.getTags().put("ai.spring-boot.version", SpringBootVersion.getVersion());
telemetryContext.getTags().put("ai.spring.version", SpringVersion.getVersion());
String ipAddress = relaxedPropertyResolver.getProperty("spring.cloud.client.ipAddress");
if (ipAddress != null) {
// if spring-cloud is available we can set ip address
telemetryContext.getTags().put(ContextTagKeys.getKeys().getLocationIP(), ipAddress);
}
}
开发者ID:gavlyukovskiy,项目名称:azure-application-insights-spring-boot-starter,代码行数:12,代码来源:SpringBootContextInitializer.java
示例5: main
import org.springframework.core.SpringVersion; //导入依赖的package包/类
public static void main(String[] args) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(ApplicationConfig.class);
ctx.refresh();
System.out.println("Spring Framework Version: " + SpringVersion.getVersion());
System.out.println("Spring Boot Version: " + SpringBootVersion.getVersion());
JpaUI ui = ctx.getBean(JpaUI.class);
ui.init();
ctx.close();
}
示例6: main
import org.springframework.core.SpringVersion; //导入依赖的package包/类
public static void main(String[] args) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(SolrApplicationConfig.class);
ctx.refresh();
System.out.println("Using Spring Framework Version: " + SpringVersion.getVersion());
System.out.println("Solr Active Profile: " + ctx.getEnvironment().getActiveProfiles()[0]);
SolrUI ui = ctx.getBean(SolrUI.class);
if (doReIndex(args))
ui.populate();
else
ui.init();
ctx.close();
}
示例7: getSources
import org.springframework.core.SpringVersion; //导入依赖的package包/类
private Set<Object> getSources(MergedContextConfiguration mergedConfig) {
Set<Object> sources = new LinkedHashSet<Object>();
sources.addAll(Arrays.asList(mergedConfig.getClasses()));
sources.addAll(Arrays.asList(mergedConfig.getLocations()));
Assert.state(!sources.isEmpty(), "No configuration classes "
+ "or locations found in @SpringApplicationConfiguration. "
+ "For default configuration detection to work you need "
+ "Spring 4.0.3 or better (found " + SpringVersion.getVersion() + ").");
return sources;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:SpringApplicationContextLoader.java
示例8: getOWIVersion
import org.springframework.core.SpringVersion; //导入依赖的package包/类
@Override
public Map<String, String> getOWIVersion() {
LOGGER.info("Using version: " + WifKeys.WIF_KEY_VERSION);
LOGGER.info("Spring version: {} ", SpringVersion.getVersion());
LOGGER.info("GeoTools version: {} ", GeoTools.getVersion());
// LOGGER.info("Datastore client version: {} ",
// dataStoreClient.getVersion());
versionsMap.put("What-If API", WifKeys.WIF_KEY_VERSION);
versionsMap.put("Spring", SpringVersion.getVersion());
versionsMap.put("Geotools", GeoTools.getVersion().toString());
versionsMap.put("DatastoreClient", "N/A");
return versionsMap;
}
示例9: getSources
import org.springframework.core.SpringVersion; //导入依赖的package包/类
private Set<Object> getSources(MergedContextConfiguration mergedConfig) {
Set<Object> sources = new LinkedHashSet<Object>();
sources.addAll(Arrays.asList(mergedConfig.getClasses()));
sources.addAll(Arrays.asList(mergedConfig.getLocations()));
Assert.state(sources.size() > 0, "No configuration classes "
+ "or locations found in @SpringApplicationConfiguration. "
+ "For default configuration detection to work you need "
+ "Spring 4.0.3 or better (found " + SpringVersion.getVersion() + ").");
return sources;
}
示例10: getSpringFrameworkVersion
import org.springframework.core.SpringVersion; //导入依赖的package包/类
@SuppressWarnings("static-access")
public static String getSpringFrameworkVersion()
{
String version = null;
try {
SpringVersion springVersion = new SpringVersion();
version = springVersion.getVersion();
}
catch (Exception x) {}
return version == null ? "3.2.14" : version.replace(".RELEASE", "");
}
示例11: createDefaultConverterManager
import org.springframework.core.SpringVersion; //导入依赖的package包/类
private static ConverterManager createDefaultConverterManager() {
String springVersion = SpringVersion.getVersion();
if(springVersion == null) {
LOG.debug("Could not determine the Spring Version. Guessing > Spring 3.0. If this does not work, please ensure to explicitly set converterManager");
return new ConversionServiceConverterManager();
} else if(springVersion.compareTo("3.0") > 0) {
return new ConversionServiceConverterManager();
} else {
return new ConverterManagerImpl();
}
}
示例12: springVersionIsNull
import org.springframework.core.SpringVersion; //导入依赖的package包/类
@Test
public void springVersionIsNull() {
spy(SpringVersion.class);
when(SpringVersion.getVersion()).thenReturn(null);
DefaultObjectDirectoryMapper mapper = new DefaultObjectDirectoryMapper();
// LDAP-300
assertThat(Whitebox.getInternalState(mapper,"converterManager")).isNotNull();
}
示例13: testBasic
import org.springframework.core.SpringVersion; //导入依赖的package包/类
@Test
public void testBasic() throws Exception {
// this creates a temporary copy of src/test/projects/basic test project
File basedir = resources.getBasedir("basic");
// create MavenProject model for the test project
MavenProject project = maven.readMavenProject(basedir);
// add annotation processor to the test project dependencies (i.e.
// classpath)
File springContext = new File(Bean.class.getProtectionDomain().getCodeSource().getLocation().toURI());
maven.newDependency(springContext.getCanonicalFile()).setArtifactId("spring-context").addTo(project);
File springCore = new File(SpringVersion.class.getProtectionDomain().getCodeSource().getLocation().toURI());
maven.newDependency(springCore.getCanonicalFile()).setArtifactId("spring-core").addTo(project);
File springBean = new File(BeanDefinition.class.getProtectionDomain().getCodeSource().getLocation().toURI());
maven.newDependency(springBean.getCanonicalFile()).setArtifactId("spring-bean").addTo(project).addTo(project);
File verifiedApi = new File(Verified.class.getProtectionDomain().getCodeSource().getLocation().toURI());
maven.newDependency(verifiedApi.getCanonicalFile()).setArtifactId("verifiedApi").addTo(project);
File verifiedImpl = new File(
SpringAnnotationParser.class.getProtectionDomain().getCodeSource().getLocation().toURI());
maven.newDependency(verifiedImpl.getCanonicalFile()).setArtifactId("verifiedProcessor").addTo(project);
MavenSession session = maven.newMavenSession(project);
// run java compiler with annotation processing enabled
maven.executeMojo(session, project, "compile", newParameter("compilerId", compilerId), newParameter(PROC, PROC));
File compiledClasses = new File(basedir, "target/classes");
File generatedSources = new File(basedir, "target/generated-sources/annotations");
File configurationSourceFile = (new File(generatedSources,
"com/salesforce/aptspring/ComputerHardwareConfiguration_forceInjectData.java"));
assertThat(configurationSourceFile).exists().canRead();
File configurationClass = (new File(compiledClasses,
"com/salesforce/aptspring/ComputerHardwareConfiguration_forceInjectData.class"));
assertThat(configurationClass).exists().canRead();
maven.executeMojo(session, project, "testCompile", newParameter("compilerId", compilerId),
newParameter(PROC, PROC));
File compiledTestClasses = new File(basedir, "target/test-classes");
File configurationTestClass = (new File(compiledTestClasses,
"com/salesforce/aptspring/RootApplicationConfiguration_forceInjectData.class"));
assertThat(configurationTestClass).exists().canRead();
}
示例14: onStartup
import org.springframework.core.SpringVersion; //导入依赖的package包/类
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
initialApplicationContext(servletContext);
servletContext.log("===============================================================================");
servletContext.log("Java EE 6 Servlet 3.0");
servletContext.log("Nbone Version: " + NboneVersion.getVersion(NboneVersion.version));
servletContext.log("Spring Version: " + SpringVersion.getVersion());
String encoding = servletContext.getInitParameter("encoding");
servletContext.log("current WebApplication config set character encoding: "+ encoding +" .thinking");
if(!StringUtils.hasText(encoding)){
encoding = CharsetConstant.CHARSET_UTF8;
servletContext.log("current WebApplication use default character encoding: "+ encoding +" .thinking");
}
servletContext.log("===============================================================================");
//DispatcherServlet
initDispatcherServlet(servletContext);
//CharacterEncodingFilter
initCharacterEncodingFilter(servletContext, encoding);
//HiddenHttpMethodFilter
initHiddenHttpMethodFilter(servletContext);
//HttpPutFormContentFilter
initHttpPutFormContentFilter(servletContext);
//XXX:ThinkPrepareFilter 特殊情况下开启暂存 request response
//initThinkPrepareFilter(servletContext);
//RequestContextFilter
initRequestContextFilter(servletContext);
//GzipFilter
initGzipFilter(servletContext);
//HibernateLazy
initHibernateOpenSessionInViewFilter(servletContext);
}
示例15: main
import org.springframework.core.SpringVersion; //导入依赖的package包/类
public static void main(String[] args) {
System.err.println(SpringVersion.getVersion());
}