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

Change setter name for isolationLevelForCreate in AbstractJobRepositoryFactoryBean #4213

Closed
fmbenhassine opened this issue Oct 18, 2022 · 0 comments

Comments

@fmbenhassine
Copy link
Contributor

AbstractJobRepositoryFactoryBean provides two overloaded setters for the isolationLevelForCreate property: one that takes a String as a parameter, and one that takes an enum org.springframework.transaction.annotation.Isolation. This can cause ambiguity when Spring tries to set the property in XML configuration when selecting the setter to use, and can lead to:

Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'org.springframework.transaction.annotation.Isolation' for property 'isolationLevelForCreate'; Cannot convert value of type 'java.lang.String' to required type 'org.springframework.transaction.annotation.Isolation' for property 'isolationLevelForCreate': no matching editors or conversion strategy found
	at org.springframework.beans.AbstractNestablePropertyAccessor.convertIfNecessary(AbstractNestablePropertyAccessor.java:594)
	at org.springframework.beans.AbstractNestablePropertyAccessor.convertForProperty(AbstractNestablePropertyAccessor.java:608)
	at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:190)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1713)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1670)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1414)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:598)
	... 145 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'org.springframework.transaction.annotation.Isolation' for property 'isolationLevelForCreate': no matching editors or conversion strategy found
	at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:262)
	at org.springframework.beans.AbstractNestablePropertyAccessor.convertIfNecessary(AbstractNestablePropertyAccessor.java:589)
	... 151 more

The Spring recommendation for this is to use different names for setters. This issue is to rename the setter that takes the Isolation enum as a parameter to setIsolationLevelForCreateEnum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant