Reputation: 1678
I'm trying to load a .class file into Spring project. I tried this:
WebApplicationContext context = ContextLoader.getCurrentWebApplicationContext();
ResourcePatternResolver resolver = (ResourcePatternResolver)context;
Resource[] res = resolver.getResources("classpath*:/opt/validation/*.class");
resolver.getClassLoader().loadClass("ValidateProcessor");
But I I get error Root cause of ServletException.
java.lang.ClassNotFoundException: ValidateProcessor
The file ValidateProcessor.class is present into that directory but it's not found. Can you give me some advice how to fix this issue please?
Upvotes: 0
Views: 113
Reputation: 10511
You have to use the full qualified class name. In case the class is located in a package opt.validation
you should load:
resolver.getClassLoader().loadClass("opt.validation.ValidateProcessor");
Upvotes: 1