<dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-component-annotations</artifactId> <version>1.7.1</version> </dependency> import org.codehaus.plexus.component.annotations.Component; @Component(role = MyComponent.class, instantiationStrategy = InstantiationStrategy.SINGLETON) public class MyComponentImpl implements MyComponent { // Component implementation } <component-set> <components> <component> <role>com.example.MyComponent</role> <role-hint>default</role-hint> <implementation>com.example.MyComponentImpl</implementation> </component> </components> </component-set> import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Inject; @Component(role = MyComponent.class, instantiationStrategy = InstantiationStrategy.SINGLETON) public class MyComponentImpl implements MyComponent { @Inject private OtherComponent otherComponent; // Component implementation }


上一篇:
下一篇:
切换中文