Description
Hi,
I recently opened an issue to track the needed stuff for Spring-Boot in order to support Java 17. spring-projects/spring-boot#26767. I think it makes sense to have the same for Spring Framework.
Known issues:
- Sealed interfaces need to be handled e.g. when creating proxies.
@Bean
@Scope(proxyMode = ScopedProxyMode.INTERFACES)
String alpha() {
return "alpha";
}
Essentially, under the hood it retrieves all interfaces of String
here which also includes ConstantDesc
which is a sealed interface and cannot be used when creating a proxy. See ScopedProxyFactoryBean.setBeanFactory
:
if (!isProxyTargetClass() || beanType.isInterface() || Modifier.isPrivate(beanType.getModifiers())) {
// This should filter sealed interfaces I guess
pf.setInterfaces(ClassUtils.getAllInterfacesForClass(beanType, cbf.getBeanClassLoader()));
}
After a first look this probably needs to be handled more centrally and more places are potentially affected by sealed interfaces.
There is likely more to do for Java 17 support, but I wanted to kick this off. Feel free to add to this issue or repurpose it to only handle the specific issue.
Let me know if I can help.
Cheers,
Christoph