-
Notifications
You must be signed in to change notification settings - Fork 353
Provide implementation of BeanFactoryNativeConfigurationProcessor for function types #1351
Conversation
… function types Add initial implementation of FunctionTypeProcessor and FunctionTypeProcessorTests Modified samples to remove TypeHint as well as reference to it in the README Upgrade Spring Cloud dependency to 2021.0.0
!name.startsWith("javax.")) { | ||
if (added.add(name)) { | ||
registry.reflection().forType(FunctionTypeUtils.getRawType(inputType)) | ||
.withAccess(TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.PUBLIC_CONSTRUCTORS, TypeAccess.DECLARED_FIELDS, TypeAccess.PUBLIC_FIELDS, TypeAccess.DECLARED_METHODS, TypeAccess.PUBLIC_METHODS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are TypeAccess.DECLARED_FIELDS
and TypeAccess.PUBLIC_FIELDS
really needed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not. It was mainly cut/paste from the 'alike' component, so i'll fix it
|
||
private boolean isFunction(Class<?> beanType) { | ||
return Function.class.isAssignableFrom(beanType) | ||
|| Consumer.class.isAssignableFrom(beanType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we check via the presence of a bean type in beanFactory
that Spring Cloud Function is enabled in this application?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, the fact that I am using FunctionTypeUtils
means s-c-function is on the classpath. We don't have any explicit enable functionality, hence my earlier question, how do these processors work when the "optional" dependency they are using is not available. So I am not sure what else i can add here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like discussed I am not sure how those processors do not break when for example here FunctionTypeUtils
is not in the classpath, I think that's what I observed on other ones. Maybe @snicoll will know ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@olegz you got the Processor
nested class pattern right, except you're not checking any condition so that makes it useless. See https://github.com/spring-projects-experimental/spring-native/blob/906925e9d4e0b5c13fe755b86d934dc7eb479aa8/spring-aot/src/main/java/org/springframework/boot/actuate/endpoint/annotation/EndpointNativeConfigurationProcessor.java#L49 for example.
Well, the fact that I am using FunctionTypeUtils means s-c-function is on the classpath.
Right now if you run this hint without Spring Cloud Function, it will fail with NCDFE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, sorry missed it. That is what I was asking Sebastien earlier about Conditional
. Anyway, let me fix that
@@ -0,0 +1 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be removed right?
org.springframework.core.IndexedBeanHierarchyNativeConfigurationProcessor,\ | ||
org.springframework.context.annotation.ScopeNativeConfigurationProcessor | ||
org.springframework.cloud.function.FunctionTypeProcessor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add initial implementation of FunctionTypeProcessor and FunctionTypeProcessorTests
Modified samples to remove TypeHint as well as reference to it in the README
Upgrade Spring Cloud dependency to 2021.0.0