Je tente d'exécuter un script groovy au démarrage pour une application Web. Je suis d'abord en train de suivre un exemple tiré du livre Spring Recipes.Groove Spring Bean Classpath
J'ai un SimpleInterestCalculator dans le paquet suivant - com.apress.springrecipes.interest
Le paquet de haricots est src/test/resources
dans un paquet com.wer.com
, et c'est où le haricot est.
Mon entrée dans c'est
<lang:groovy id="interestCalculator" script-source="classpath:com/apress/springrecipes/interest/SimpleInterestCalculator.groovy">
<lang:property name="rateCalculator" value="rateCalculator" />
</lang:groovy>
Je reçois l'erreur suivante.
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'simpleInterestCalculator':
Could not determine scripted object type for GroovyScriptFactory:
script source locator [classpath:src/com/apress/springrecipes/interest/SimpleInterestCalculator.groovy];
nested exception is java.io.FileNotFoundException:
class path resource [src/com/apress/springrecipes/interest/SimpleInterestCalculator.groovy] cannot be opened because it does not exist
Je vous ai déjà expliqué comment exécuter un script Groovy au démarrage d'une application Spring. Vous devriez accepter ou commenter cette réponse avant de poser une nouvelle question similaire. –