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

2.0.0.RC2 fails to bind ConfigurationProperties of type List<Class<? extends Throwable>> #12166

Closed
larsgrefer opened this issue Feb 22, 2018 · 6 comments
Assignees
Labels
type: regression A regression from a previous release
Milestone

Comments

@larsgrefer
Copy link
Contributor

Spring Boot 2.0.0.RC2 fails to bind a configuration property of type List<Class<? extends Throwable>>.
With 2.0.0.RC1 everything was working fine.

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::            (v2.0.0.RC2)

01:11:06.495 [main] INFO  o.j.a.o.OmnifacesPropertiesIT - Starting OmnifacesPropertiesIT on Larss-Air.fritz.box with PID 27009 (started by larsgrefer in /Volumes/Daten/git/joinfaces/joinfaces-autoconfigure)
01:11:06.501 [main] INFO  o.j.a.o.OmnifacesPropertiesIT - The following profiles are active: propertyTest
01:18:34.409 [main] WARN  o.s.w.c.s.GenericWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'jsf.omnifaces-org.joinfaces.autoconfigure.omnifaces.OmnifacesProperties': Could not bind properties to 'OmnifacesProperties' : prefix=jsf.omnifaces, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'jsf.omnifaces.exception-types-to-unwrap' to java.util.List<java.lang.Class<java.lang.Throwable>>
01:18:34.777 [main] ERROR o.s.b.d.LoggingFailureAnalysisReporter - 

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to bind properties under 'jsf.omnifaces.exception-types-to-unwrap' to java.util.List<java.lang.Class<java.lang.Throwable>>:

    Reason: No converter found capable of converting from type [java.lang.String] to type [@org.joinfaces.autoconfigure.configuration.ServletContextInitParameter java.util.List<java.lang.Class<java.lang.Throwable>>]

Action:

Update your application's configuration

01:18:34.813 [main] ERROR o.s.test.context.TestContextManager - Caught exception while allowing TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener@75aea2ba] to prepare test instance [org.joinfaces.autoconfigure.omnifaces.OmnifacesPropertiesIT@2a47597]
java.lang.IllegalStateException: Failed to load ApplicationContext
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:125)
	at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:107)
	at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190)
	at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:132)
	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:242)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'jsf.omnifaces-org.joinfaces.autoconfigure.omnifaces.OmnifacesProperties': Could not bind properties to 'OmnifacesProperties' : prefix=jsf.omnifaces, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'jsf.omnifaces.exception-types-to-unwrap' to java.util.List<java.lang.Class<java.lang.Throwable>>
	at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.bind(ConfigurationPropertiesBindingPostProcessor.java:109)
	at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:93)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:423)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1702)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:583)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:502)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:868)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
	at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:138)
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99)
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117)
	... 24 common frames omitted
Caused by: org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'jsf.omnifaces.exception-types-to-unwrap' to java.util.List<java.lang.Class<java.lang.Throwable>>
	at org.springframework.boot.context.properties.bind.Binder.handleBindError(Binder.java:250)
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:226)
	at org.springframework.boot.context.properties.bind.Binder.lambda$bindBean$4(Binder.java:331)
	at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:72)
	at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:61)
	at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:53)
	at org.springframework.boot.context.properties.bind.Binder.lambda$null$5(Binder.java:339)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1351)
	at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
	at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
	at org.springframework.boot.context.properties.bind.Binder.lambda$bindBean$6(Binder.java:340)
	at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:439)
	at org.springframework.boot.context.properties.bind.Binder$Context.withBean(Binder.java:425)
	at org.springframework.boot.context.properties.bind.Binder$Context.access$400(Binder.java:379)
	at org.springframework.boot.context.properties.bind.Binder.bindBean(Binder.java:337)
	at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:279)
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:221)
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:210)
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:192)
	at org.springframework.boot.context.properties.ConfigurationPropertiesBinder.bind(ConfigurationPropertiesBinder.java:78)
	at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.bind(ConfigurationPropertiesBindingPostProcessor.java:106)
	... 42 common frames omitted
Caused by: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [@org.joinfaces.autoconfigure.configuration.ServletContextInitParameter java.util.List<java.lang.Class<java.lang.Throwable>>]
	at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:321)
	at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:194)
	at org.springframework.boot.context.properties.bind.BindConverter.convert(BindConverter.java:75)
	at org.springframework.boot.context.properties.bind.IndexedElementsBinder.convert(IndexedElementsBinder.java:143)
	at org.springframework.boot.context.properties.bind.IndexedElementsBinder.bindIndexed(IndexedElementsBinder.java:84)
	at org.springframework.boot.context.properties.bind.IndexedElementsBinder.bindIndexed(IndexedElementsBinder.java:70)
	at org.springframework.boot.context.properties.bind.CollectionBinder.bindAggregate(CollectionBinder.java:49)
	at org.springframework.boot.context.properties.bind.AggregateBinder.bind(AggregateBinder.java:58)
	at org.springframework.boot.context.properties.bind.Binder.lambda$bindAggregate$2(Binder.java:306)
	at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:439)
	at org.springframework.boot.context.properties.bind.Binder$Context.access$100(Binder.java:379)
	at org.springframework.boot.context.properties.bind.Binder.bindAggregate(Binder.java:305)
	at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:263)
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:221)
	... 67 common frames omitted

java.lang.IllegalStateException: Failed to load ApplicationContext

	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:125)
	at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:107)
	at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190)
	at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:132)
	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:242)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'jsf.omnifaces-org.joinfaces.autoconfigure.omnifaces.OmnifacesProperties': Could not bind properties to 'OmnifacesProperties' : prefix=jsf.omnifaces, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'jsf.omnifaces.exception-types-to-unwrap' to java.util.List<java.lang.Class<java.lang.Throwable>>
	at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.bind(ConfigurationPropertiesBindingPostProcessor.java:109)
	at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:93)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:423)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1702)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:583)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:502)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:868)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
	at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:138)
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99)
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117)
	... 24 more
Caused by: org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'jsf.omnifaces.exception-types-to-unwrap' to java.util.List<java.lang.Class<java.lang.Throwable>>
	at org.springframework.boot.context.properties.bind.Binder.handleBindError(Binder.java:250)
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:226)
	at org.springframework.boot.context.properties.bind.Binder.lambda$bindBean$4(Binder.java:331)
	at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:72)
	at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:61)
	at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:53)
	at org.springframework.boot.context.properties.bind.Binder.lambda$null$5(Binder.java:339)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1351)
	at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
	at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
	at org.springframework.boot.context.properties.bind.Binder.lambda$bindBean$6(Binder.java:340)
	at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:439)
	at org.springframework.boot.context.properties.bind.Binder$Context.withBean(Binder.java:425)
	at org.springframework.boot.context.properties.bind.Binder$Context.access$400(Binder.java:379)
	at org.springframework.boot.context.properties.bind.Binder.bindBean(Binder.java:337)
	at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:279)
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:221)
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:210)
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:192)
	at org.springframework.boot.context.properties.ConfigurationPropertiesBinder.bind(ConfigurationPropertiesBinder.java:78)
	at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.bind(ConfigurationPropertiesBindingPostProcessor.java:106)
	... 42 more
Caused by: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [@org.joinfaces.autoconfigure.configuration.ServletContextInitParameter java.util.List<java.lang.Class<java.lang.Throwable>>]
	at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:321)
	at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:194)
	at org.springframework.boot.context.properties.bind.BindConverter.convert(BindConverter.java:75)
	at org.springframework.boot.context.properties.bind.IndexedElementsBinder.convert(IndexedElementsBinder.java:143)
	at org.springframework.boot.context.properties.bind.IndexedElementsBinder.bindIndexed(IndexedElementsBinder.java:84)
	at org.springframework.boot.context.properties.bind.IndexedElementsBinder.bindIndexed(IndexedElementsBinder.java:70)
	at org.springframework.boot.context.properties.bind.CollectionBinder.bindAggregate(CollectionBinder.java:49)
	at org.springframework.boot.context.properties.bind.AggregateBinder.bind(AggregateBinder.java:58)
	at org.springframework.boot.context.properties.bind.Binder.lambda$bindAggregate$2(Binder.java:306)
	at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:439)
	at org.springframework.boot.context.properties.bind.Binder$Context.access$100(Binder.java:379)
	at org.springframework.boot.context.properties.bind.Binder.bindAggregate(Binder.java:305)
	at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:263)
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:221)
	... 67 more

Working Unit test: https://github.com/persapiens/joinfaces/blob/0e7c5a02a28b9c0785cf350150b5b0c1e96c9b11/joinfaces-autoconfigure/src/test/java/org/joinfaces/autoconfigure/omnifaces/OmnifacesPropertiesIT.java#L51

Broken Unit test https://github.com/persapiens/joinfaces/blob/72d592897fb41efcc9e128500e77c77a072a49fb/joinfaces-autoconfigure/src/test/java/org/joinfaces/autoconfigure/omnifaces/OmnifacesPropertiesIT.java#L51

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 22, 2018
@philwebb philwebb added type: bug A general bug priority: normal and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 22, 2018
@philwebb philwebb added this to the 2.0.0 milestone Feb 22, 2018
@philwebb
Copy link
Member

Here's a small addition to ConfigurationPropertiesTests that replicates it:

	@Test
	public void loadWhenBindingToListOfGenericClassShouldBind() {
		SimpleTypeConverter simpleTypeConverter = new SimpleTypeConverter();
		this.context.getBeanFactory().copyRegisteredEditorsTo(simpleTypeConverter);
		Class<?> converted = simpleTypeConverter
				.convertIfNecessary("java.lang.RuntimeException", Class.class);
		assertThat(converted).isEqualTo(RuntimeException.class);
		load(ListOfGenericClassProperties.class, "test.list=java.lang.RuntimeException");
		ListOfGenericClassProperties bean = this.context
				.getBean(ListOfGenericClassProperties.class);
		assertThat(bean.getList()).containsExactly(RuntimeException.class);
	}

@philwebb
Copy link
Member

OK, I think I know what's going on. In RC1 we had a PropertyEditorConverter class that would bridge the two type conversion worlds. In RC2 we dropped that in favor of calling SimpleTypeConverter directly first.

When we call SimpleTypeConverter we skip Collection conversion because we don't have information about the generics. That means we end up in the ConversionService, but it doesn't know how to convert String -> Class, so the element conversion fails.

The logic is:

  • Skip SimpleTypeConverter because it's a Collection
  • Ask ConversionService to convert String -> List<Class>.
  • Conversion service finds DelimitedStringToCollectionConverter
  • DelimitedStringToCollectionConverter asks ConversionService about element type
  • ConversionService doesn't know how to convert String -> Class

Conversion fails.

@philwebb
Copy link
Member

I think we'll need to make BindConverter aware of Collection, Map and Array types. Implementing some logic similar to TypeConverterDelegate.convertToTypedCollection which we can't directly use.

@wilkinsona wilkinsona added type: regression A regression from a previous release and removed type: bug A general bug labels Feb 22, 2018
@philwebb philwebb self-assigned this Feb 22, 2018
@philwebb
Copy link
Member

@larsgrefer You you try the latest SNAPSHOT if you get a chance to see if this is now fixed for you?

@larsgrefer
Copy link
Contributor Author

@philwebb Sure. The current 2.0.0.BUILD-SNAPSHOT works fine.

@philwebb
Copy link
Member

@larsgrefer Great news! Thanks for reporting this before we went GA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: regression A regression from a previous release
Projects
None yet
Development

No branches or pull requests

4 participants