Skip to content

migrating to SpringBoot 2.0 ServerPropertiesAutoConfiguration cannot be opened because it does not exist #12985

@gm100861

Description

@gm100861

Hello, I am migrating to SpringBoot 2.0, While performing the upgrade I am getting the following error. Can you please help me?

Application Version: 
Spring Boot Version: 2.0.1.RELEASE (v2.0.1.RELEASE)
2018-04-27 15:10:34.087  INFO 17160 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: http://192.168.0.226:9001/
2018-04-27 15:10:34.547  INFO 17160 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=lhw-qingyun-xs-user-service, profiles=[test], label=master, version=6135797957be9acc22e602e0e04d78342485a37c, state=null
2018-04-27 15:10:34.547  INFO 17160 --- [           main] b.c.PropertySourceBootstrapConfiguration : Located property source: CompositePropertySource {name='configService', propertySources=[MapPropertySource {name='configClient'}, MapPropertySource {name='http://192.168.0.200/pinshang/document.git/configure-repo/test/lhw-qingyun-xs-user-service-test.yml'}]}
2018-04-27 15:10:34.637  INFO 17160 --- [           main] c.p.qingyun.ApplicationXSUserService     : The following profiles are active: test
2018-04-27 15:10:34.813  INFO 17160 --- [           main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@7dd00705: startup date [Fri Apr 27 15:10:34 CST 2018]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@4de41af9
2018-04-27 15:10:35.983  WARN 17160 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [com.pinshang.qingyun.ApplicationXSUserService]; nested exception is java.io.FileNotFoundException: class path resource [org/springframework/boot/autoconfigure/web/ServerPropertiesAutoConfiguration.class] cannot be opened because it does not exist
2018-04-27 15:10:35.987  WARN 17160 --- [           main] o.s.b.c.p.m.PropertiesMigrationListener  : 
The use of configuration keys that have been renamed was found in the environment:

Property source 'bootstrapProperties':
	Key: security.user.name
		Replacement: spring.security.user.name
	Key: security.user.password
		Replacement: spring.security.user.password


Each configuration key has been temporarily mapped to its replacement for your convenience. To silence this warning, please update your configuration to use the new keys.

2018-04-27 15:10:35.988 ERROR 17160 --- [           main] o.s.b.c.p.m.PropertiesMigrationListener  : 
The use of configuration keys that are no longer supported was found in the environment:

Property source 'applicationConfig: [classpath:/application.yml]':
	Key: security.ignored
		Line: 2
		Reason: The security auto-configuration is no longer customizable.

Property source 'bootstrapProperties':
	Key: management.security.enabled
		Reason: A global security auto-configuration is now provided.
	Key: management.security.roles
		Reason: The security auto-configuration is no longer customizable.


Please refer to the migration guide or reference guide for potential alternatives.

2018-04-27 15:10:35.993  INFO 17160 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-04-27 15:10:36.010 ERROR 17160 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [com.pinshang.qingyun.ApplicationXSUserService]; nested exception is java.io.FileNotFoundException: class path resource [org/springframework/boot/autoconfigure/web/ServerPropertiesAutoConfiguration.class] cannot be opened because it does not exist
	at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:645)
	at org.springframework.context.annotation.ConfigurationClassParser.lambda$processDeferredImportSelectors$2(ConfigurationClassParser.java:564)
	at java.util.ArrayList.forEach(ArrayList.java:1249)
	at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:560)
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:188)
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:316)
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:233)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93)
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:694)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243)
	at com.pinshang.qingyun.ApplicationXSUserService.main(ApplicationXSUserService.java:29)
Caused by: java.io.FileNotFoundException: class path resource [org/springframework/boot/autoconfigure/web/ServerPropertiesAutoConfiguration.class] cannot be opened because it does not exist
	at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:180)
	at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:51)
	at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103)
	at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.createMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:88)
	at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.getMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:75)
	at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:81)
	at org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:731)
	at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getRelated(ConfigurationClassParser.java:1007)
	at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getAnnotationAttributes(ConfigurationClassParser.java:988)
	at org.springframework.context.annotation.ConfigurationClassParser.collectImports(ConfigurationClassParser.java:536)
	at org.springframework.context.annotation.ConfigurationClassParser.getImports(ConfigurationClassParser.java:509)
	at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:300)
	at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:245)
	at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:635)
	... 17 common frames omitted

ServerPropertiesAutoConfiguration was there in SpringBoot 1.5.x but is missing in 2.0. It might have changed but I am not finding any information on how we replace this class. anyone can help me, please!

Metadata

Metadata

Assignees

No one assigned

    Labels

    for: stackoverflowA question that's better suited to stackoverflow.com

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions