Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Environment variable that does not follow guidelines for use of _ is still successfully bound if another property source contains a property that is bound to the same target #14479

Closed
Bert-R opened this issue Sep 15, 2018 · 18 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@Bert-R
Copy link

Bert-R commented Sep 15, 2018

We have custom properties, built like this:

@ConfigurationProperties("yona")
@Configuration
public class YonaProperties
{
	@NestedConfigurationProperty
	private final AnalysisServiceProperties analysisService = new AnalysisServiceProperties();

Properties would be set on AnalysisServiceProperties in this way:

yona.analysisService.someProperty=someValue

Or through an environment variable, like this:

YONA_ANALYSIS_SERVICE_SOME_PROPERTY=someValue

With Spring Boot 1.5, it was OK to not have any yona.analysisService.xxx property in application.properties and still set one through an environment variable like YONA_ANALYSIS_SERVICE_XXX.

With Spring Boot 2.0.4, that doesn't work anymore. At least one yona.analysisService.xxx must exist in application.properties. It's OK to set xxx in application.properties and yyy through the environment, but there needs to be at least one.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 15, 2018
@wilkinsona
Copy link
Member

Here's a minimal example that reproduces the behaviour described above:

package com.example.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
@EnableConfigurationProperties(YonaProperties.class)
public class Gh14479Application {

	public static void main(String[] args) {
		ConfigurableApplicationContext context = SpringApplication.run(Gh14479Application.class, args);
		YonaProperties yonaProperties = context.getBean(YonaProperties.class);
		System.out.println((yonaProperties.getAnalysisService().getAlpha()));
		System.out.println((yonaProperties.getAnalysisService().getBravo()));
	}

}

@ConfigurationProperties("yona")
class YonaProperties {

	private final AnalysisServiceProperties analysisService = new AnalysisServiceProperties();

	public AnalysisServiceProperties getAnalysisService() {
		return analysisService;
	}

	public class AnalysisServiceProperties {

		private String alpha;

		private String bravo;

		public String getAlpha() {
			return alpha;
		}

		public void setAlpha(String alpha) {
			this.alpha = alpha;
		}

		public String getBravo() {
			return bravo;
		}

		public void setBravo(String bravo) {
			this.bravo = bravo;
		}

	}

}

Run with no properties:

$ java -jar target/gh-14479-0.0.1-SNAPSHOT.jar
…
null
null

Run with an environment variable and a command line property and both take effect:

$ YONA_ANALYSIS_SERVICE_ALPHA=one java -jar target/gh-14479-0.0.1-SNAPSHOT.jar --yona.analysis-service.bravo=two
…
one
two

Run with just a command line property and it takes effect:

$ java -jar target/gh-14479-0.0.1-SNAPSHOT.jar --yona.analysis-service.bravo=two
…
null
two

Run with just an environment variable and it has no effect:

$ YONA_ANALYSIS_SERVICE_ALPHA=one java -jar target/gh-14479-0.0.1-SNAPSHOT.jar
…
null
null

@wilkinsona wilkinsona added this to the 2.0.x milestone Sep 15, 2018
@wilkinsona wilkinsona added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 15, 2018
@Bert-R
Copy link
Author

Bert-R commented Sep 15, 2018

That's it indeed. Thanks for making the repro!

@wilkinsona
Copy link
Member

When only the environment variable is set, the configuration property name yona.analysis-service is called with yona.analysis.service.alpha and yonaanalysisservicealpha to see if it's an ancestor. In both cases false is returned so it appears that the are no properties to be bound to the AnalysisServiceProperties instance so binding stops.

When the property yona.analysis-service.bravo has been set on the command line in addition to the environment variable, the configuration property name yona.analysis-service is also called with yona.analysis-service.bravo. It correctly determines that it is an ancestor of the passed-in name, so binding continues and both properties are then bound.

@wilkinsona
Copy link
Member

The behaviour described above is a symptom of the environment variable not meeting the documented requirements. Specifically, _ should not be used within the name of a property. This means that the environment variable should be named YONA_ANALYSISSERVICE_ALPHA rather than YONA_ANALYSIS_SERVICE_ALPHA. If the former is used, binding works as expected.

I'm going to leave this open for now as the current behaviour is (to me at least) a bit confusing. Ideally, an environment variable that doesn't meet the required guidelines should never bind, irrespective of any other properties that have been configured.

@wilkinsona wilkinsona added for: team-attention An issue we'd like other members of the team to review status: waiting-for-triage An issue we've not yet triaged and removed type: bug A general bug labels Sep 18, 2018
@wilkinsona wilkinsona removed this from the 2.0.x milestone Sep 18, 2018
@wilkinsona wilkinsona changed the title Environment variable not bound to property anymore Environment variable that does not follow guidelines for use of _ is still successfully bound is another property source contains a property that is bound to the same target Sep 18, 2018
@wilkinsona wilkinsona changed the title Environment variable that does not follow guidelines for use of _ is still successfully bound is another property source contains a property that is bound to the same target Environment variable that does not follow guidelines for use of _ is still successfully bound if another property source contains a property that is bound to the same target Sep 18, 2018
@Bert-R
Copy link
Author

Bert-R commented Sep 18, 2018

That's actually not the case. See the property class implementation here. The property name is camelCased, see application.properties.

@wilkinsona
Copy link
Member

Sorry, I'm not sure what you think isn't the case. The property class and the configuration in application.properties are both fine. It's the environment variable that's problematic. Taking things back to your original example, you need to use YONA_ANALYSISSERVICE_SOMEPROPERTY rather than YONA_ANALYSIS_SERVICE_SOME_PROPERTY so that the _ separators are only used in between properties and not within the name of a property.

@Bert-R
Copy link
Author

Bert-R commented Sep 18, 2018

Mmm. Is that the aspect of relaxed binding being a little less relaxed in 2.0? :)

@wilkinsona
Copy link
Member

Yes, this is part of the relaxed binding not being quite so relaxed.

@Bert-R
Copy link
Author

Bert-R commented Sep 18, 2018

OK, clear. It's a bit unfortunate that it sometimes works, depending on whether or not the property was bound otherwise.

@wilkinsona wilkinsona added this to the 2.1.x milestone Sep 19, 2018
@philwebb philwebb added the type: bug A general bug label Sep 19, 2018
@wilkinsona wilkinsona removed for: team-attention An issue we'd like other members of the team to review status: waiting-for-triage An issue we've not yet triaged labels Sep 19, 2018
@wilkinsona
Copy link
Member

We'd like to fix this by the binding ignoring the environment variable that's malformed.

@wilkinsona
Copy link
Member

Fixing this as we'd like will regress #10873.

I think we have a few options:

  1. Revert the change for Support environment properties that would have worked in 1.5 #10873 such that foo.the-bar just produces FOO_THEBAR
  2. Change the ancestor checking somehow such that yona.analysis-service would be identified as an ancestor of YONA_ANALYSIS_SERVICE_SOME_PROPERTY
  3. Live with the current behavior

2 feels like the least bad option, but I'm not sure how realistic it is.

@mbhave
Copy link
Contributor

mbhave commented Oct 5, 2018

I think we should revert the change for #10873 because it's confusing that the 1.5 style properties only work sometimes.

@philwebb
Copy link
Member

philwebb commented Oct 5, 2018

We could perhaps revert #10873 for 2.1, but I think it would be a bit harsh to do it in 2.0.x. If I remember correctly #10873 was also added at the request of a Spring Cloud project (but I can't remember which one).

@wilkinsona
Copy link
Member

I wonder if we could make the ancestor checking more lenient? What about ignoring everything that isn’t a letter, and then, ignoring case, seeing if one starts with the other. Occasional false positives aren’t the end of the world as it’s just used as a way of short-circuiting binding isn’t it?

@mbhave
Copy link
Contributor

mbhave commented Oct 5, 2018

The ancestor check is also used in the MapBinder when binding entries in a map. Making the check lenient might cause some conversion exceptions there but I'm not totally sure.

@wilkinsona
Copy link
Member

wilkinsona commented Oct 8, 2018

I've tried adding a separate, more lenient ancestor check and only calling it from the various containsDescendantOf methods on the various ConfigurationPropertySource implementations. To simulate a worst-case scenario, I'm just returning true. Without auto-configuration enabled it fixes the scenario described above. With auto-configuration enabled it breaks other property binding. Specifically, I see this failure:

org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'spring.info.build.location.u-r-l' to java.net.URL
	at org.springframework.boot.context.properties.bind.Binder.handleBindError(Binder.java:250) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:226) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder.lambda$5(Binder.java:333) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:73) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:62) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:54) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder.lambda$7(Binder.java:341) ~[classes/:na]
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[na:1.8.0_181]
	at java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1359) ~[na:1.8.0_181]
	at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126) ~[na:1.8.0_181]
	at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498) ~[na:1.8.0_181]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485) ~[na:1.8.0_181]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[na:1.8.0_181]
	at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152) ~[na:1.8.0_181]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:1.8.0_181]
	at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464) ~[na:1.8.0_181]
	at org.springframework.boot.context.properties.bind.Binder.lambda$6(Binder.java:342) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:441) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder$Context.withBean(Binder.java:427) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder$Context.access$5(Binder.java:424) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder.bindBean(Binder.java:339) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:278) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:221) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder.lambda$5(Binder.java:333) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:73) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:62) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:54) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder.lambda$7(Binder.java:341) ~[classes/:na]
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[na:1.8.0_181]
	at java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1359) ~[na:1.8.0_181]
	at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126) ~[na:1.8.0_181]
	at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498) ~[na:1.8.0_181]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485) ~[na:1.8.0_181]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[na:1.8.0_181]
	at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152) ~[na:1.8.0_181]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:1.8.0_181]
	at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464) ~[na:1.8.0_181]
	at org.springframework.boot.context.properties.bind.Binder.lambda$6(Binder.java:342) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:441) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder$Context.withBean(Binder.java:427) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder$Context.access$5(Binder.java:424) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder.bindBean(Binder.java:339) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:278) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:221) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder.lambda$5(Binder.java:333) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:73) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:62) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:54) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder.lambda$7(Binder.java:341) ~[classes/:na]
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[na:1.8.0_181]
	at java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1359) ~[na:1.8.0_181]
	at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126) ~[na:1.8.0_181]
	at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498) ~[na:1.8.0_181]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485) ~[na:1.8.0_181]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[na:1.8.0_181]
	at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152) ~[na:1.8.0_181]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:1.8.0_181]
	at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464) ~[na:1.8.0_181]
	at org.springframework.boot.context.properties.bind.Binder.lambda$6(Binder.java:342) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:441) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder$Context.withBean(Binder.java:427) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder$Context.access$5(Binder.java:424) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder.bindBean(Binder.java:339) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:278) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:221) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:210) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:192) ~[classes/:na]
	at org.springframework.boot.context.properties.ConfigurationPropertiesBinder.bind(ConfigurationPropertiesBinder.java:82) ~[classes/:na]
	at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.bind(ConfigurationPropertiesBindingPostProcessor.java:107) ~[classes/:na]
	at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:93) ~[classes/:na]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:416) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1691) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:573) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1135) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1062) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:818) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:724) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:197) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1267) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1124) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:535) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:759) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) [classes/:na]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386) [classes/:na]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [classes/:na]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1242) [classes/:na]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1230) [classes/:na]
	at com.example.demo.Gh14479Application.main(Gh14479Application.java:15) [classes/:na]
Caused by: java.lang.IllegalStateException: Unable to get value for property u-r-l
	at org.springframework.boot.context.properties.bind.JavaBeanBinder$BeanProperty.lambda$0(JavaBeanBinder.java:307) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.JavaBeanBinder$Bean.get(JavaBeanBinder.java:186) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:49) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder.lambda$7(Binder.java:341) ~[classes/:na]
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[na:1.8.0_181]
	at java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1359) ~[na:1.8.0_181]
	at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126) ~[na:1.8.0_181]
	at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498) ~[na:1.8.0_181]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485) ~[na:1.8.0_181]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[na:1.8.0_181]
	at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152) ~[na:1.8.0_181]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:1.8.0_181]
	at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464) ~[na:1.8.0_181]
	at org.springframework.boot.context.properties.bind.Binder.lambda$6(Binder.java:342) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:441) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder$Context.withBean(Binder.java:427) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder$Context.access$5(Binder.java:424) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder.bindBean(Binder.java:339) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:278) ~[classes/:na]
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:221) ~[classes/:na]
	... 99 common frames omitted
Caused by: java.lang.reflect.InvocationTargetException: null
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_181]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_181]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_181]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_181]
	at org.springframework.boot.context.properties.bind.JavaBeanBinder$BeanProperty.lambda$0(JavaBeanBinder.java:304) ~[classes/:na]
	... 118 common frames omitted
Caused by: java.io.FileNotFoundException: class path resource [META-INF/build-info.properties] cannot be resolved to URL because it does not exist
	at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:195) ~[spring-core-5.0.9.RELEASE.jar:5.0.9.RELEASE]
	... 123 common frames omitted

This is happening due to a call to getURL on the Resource that's held by org.springframework.boot.autoconfigure.info.ProjectInfoProperties.Build.

@mbhave
Copy link
Contributor

mbhave commented Apr 20, 2020

I tried something here and it seems like it would work: mbhave@b926b59

@wilkinsona @philwebb What do you think?

@philwebb philwebb modified the milestones: 2.1.x, 2.3.x, 2.3.0 May 6, 2020
@philwebb philwebb reopened this May 6, 2020
@philwebb
Copy link
Member

philwebb commented May 6, 2020

This may have broken spring cloud stream

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

5 participants