Removing a service instance registered by LuciadLightspeed is not possible. However, for many use cases, it is not necessary to remove a service instance. It is sufficient to change its behavior instead.
For example, suppose that you do not want your application to use the default layer factory for SHP data but a custom one. You obtain that behavior by registering a custom implementation of the interface with a higher priority,.
In this example, you register a custom ILcdGXYLayerFactory
implementation for SHP data:
@LcdService(service = ILcdGXYLayerFactory.class, priority = LcdService.HIGH_PRIORITY)
public static class CustomLayerFactoryWithPriority implements ILcdGXYLayerFactory {