KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Issue: Spring Component Annotation scan not picking up the class annotated in the external jar which is not included in pom.xml. But i need to scan for classes with specific annotation from external jars. These external jars will be placed in the classpath but will not be known to my application during compile time. 1) We have a maven module(artifactId="metric_processor") which produces a jar file(metric_processor.jar) and has following classes package com.metric; @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface ProcessMetric { String name(); } package com.metric; public interface MetricProcessor { int computeMetric(); } package com.metric; @ProcessMetric(name="LATENCY") @Component public class LatencyMetricProcessor implements MetricProcessor { ..... } 2) We have another maven module ("artifactId="metric_processor_external") which produces a jar(metric_processor_external.jar) and includes "metric_processor" module as compile time scope. package com.metric; @ProcessMetric(name="TEST_METRIC_EXTERNAL") @Component public class TestMetricProcessor implements MetricProcessor { .... } 3) We have a third(main) maven module(artifactId="main_application") which is a stand alone application(uses spring) which includes module "metric_processor" in compile scope. (But does not include "metric_processor_external"). The build plugin for the third module is <build> <plugins> <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>2.4</version> <configuration> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> <archive> <manifest> <mainClass>com.ma
Tags (comma-separated)
Save Edits
Cancel