We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
在Spring中的教程第一章深入学习Spring组件注册中,有这样的一段关于自定义过滤器的代码,声称可以过滤所有类名包含字符串er的类
深入学习Spring组件注册
er
public class MyTypeFilter implements TypeFilter { @Override public boolean match(MetadataReader metadataReader, MetadataReaderFactory metadataReaderFactory) { // 获取当前正在扫描的类的注解信息 AnnotationMetadata annotationMetadata = metadataReader.getAnnotationMetadata(); // 获取当前正在扫描的类的类信息 ClassMetadata classMetadata = metadataReader.getClassMetadata(); // 获取当前正在扫描的类的路径等信息 Resource resource = metadataReader.getResource(); String className = classMetadata.getClassName(); return StringUtils.hasText("er"); } }
但事实上
return StringUtils.hasText("er");
起不到任何过滤目标字符串的作用,这仅仅是个判断字符串是否为空串的函数。请作者修正~
The text was updated successfully, but these errors were encountered:
盲生你发现了华点, XD
Sorry, something went wrong.
No branches or pull requests
在Spring中的教程第一章
深入学习Spring组件注册
中,有这样的一段关于自定义过滤器的代码,声称可以过滤所有类名包含字符串er
的类但事实上
起不到任何过滤目标字符串的作用,这仅仅是个判断字符串是否为空串的函数。请作者修正~
The text was updated successfully, but these errors were encountered: