Hi all,
This is my first post in this forum, and I would first like to thank the whole team of Hibernate-Search for the great work done with this framework.
By reading this post I think @ veveloko has set a feature that I too may be interested. I think he wants to instantiate the class CustomBoosStrategy from Spring IoC container, in order to inject dependencies as a DAO class using the @Autowired, and finally this class is used by Hibernate-Search for calculating the Boost factor.
After analyzing source code I believe this integration with Spring beans is not possible, because the instantiation of BoosStrategy implementations classs is done by following method of AnnotationProcessinHelper class:
Code:
public static BoostStrategy getDynamicBoost(XProperty member) {
DynamicBoost boostAnnotation = member.getAnnotation( DynamicBoost.class );
if ( boostAnnotation == null ) {
return DefaultBoostStrategy.INSTANCE;
}
Class<? extends BoostStrategy> boostStrategyClass = boostAnnotation.impl();
BoostStrategy strategy;
try {
strategy = boostStrategyClass.newInstance();
}
catch ( Exception e ) {
throw new SearchException(
"Unable to instantiate boost strategy implementation: " + boostStrategyClass.getName()
);
}
return strategy;
}
Overall I would like to know if I can use Spring beans to create my implementations of Similarity, BoosStrategy, etc. ..
Thanks in advance, have a nice day
Antonio