Override Component doesn't work

@codrinl hi! You can create your own Metadata implementation and override default implementation by the @Primary annotation ([Spring Docs](https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#beans-autowired-annotation-primary)) or by overriding it in the spring.xml file:

<bean id="cuba_Metadata"

@prozac631 I tried both and none of them works…

  1. Primary annotation approach:
public class ScopeMetadataImpl implements Metadata 
  1. append web\src\web-spring.xml file or core\src\spring.xml file
    <bean id="cuba_Metadata" class="com.company.scope.service.ScopeMetadataImpl"/>

same error for both approaches

Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'cuba_Metadata' for bean class &#91;com.company.scope.core.sys.ScopeMetadataImpl&#93; conflicts with existing, non-compatible bean definition of same name and class &#91;com.haulmont.cuba.core.sys.MetadataImpl&#93;

I also changed the namespace to com.company.scope.core.sys.ScopeMetadataImpl as you suggested… but the error still persists. Also, my implementation is identical with the original one i found on github… so i’m 100% sure it’s not my implementation that causes the crash.
Please help !

Let’s override the default Metadata implementation.
First of all, we should create a new class that implements Metadata interface -

public class MyMetadataImpl implements Metadata {
    private final Logger log = LoggerFactory.getLogger(MyMetadataImpl.class);

I’ve copied implementation from the MetadataImpl class and changed only one method for demonstration:

public <T> T create(Class<T> entityClass) {
    log.info(">>> Hello from custom Metadata impl!");

    return __create(entityClass);

The second (and the last) step is to register our implementation in the spring.xml file (it is placed in the core module):

<bean id="cuba_Metadata"

And you can check that everything is OK when the app is starting:
Best regards,