0

El error que me salta al ejecutar Spring es este:

Field contentManagerService in com.xxxx.xxxx.negocio.impl.ContentManagerManager required a bean of type 'com.xxxx.xxxxx.cm.IContentManagerService' that could not be found.

The injection point has the following annotations:

  • @org.springframework.beans.factory.annotation.Autowired(required=true)

Action:

Consider defining a bean of type 'com.xxxx.yyyy.cm.IContentManagerService' in your configuration.

ContentManager.java

@Service
public class ContentManagerManager implements IContentManagerManager {

    private static final Logger LOG = Logger.getLogger(ContentManagerManager.class);
    
    @Autowired
    private IContentManagerService contentManagerService; //¿fail here?

    private final String usuarioCM;
    private final String claveCM;
    private final String tipoDocumentalCM;
    private final String tempFiles;

    @Autowired
    public ContentManagerManager(final PropertyFacade propertyFacade) {
        this.usuarioCM = propertyFacade.property("content.manager.user");
        this.claveCM = propertyFacade.property("content.manager.password");
        this.tipoDocumentalCM = propertyFacade.property("content.manager.tipoDocumental");
        this.tempFiles = propertyFacade.property("tempFiles");
    }
    

Mi appConfig.java

@EnableWebMvc
@Configuration
@EnableAutoConfiguration
@ComponentScan(basePackages = { "com.xxxx.yyyyy.negocio", "com.xxxxx.yyyyy.dominio",
        "com.xxxx.yyyyy.yyyy.rest", "com.xxxxx.yyyyy.persistencia" })
public class AppConfig implements WebMvcConfigurer {

    @Bean
    public PropertyFacade propertyFacade() throws IOException {
        return new PropertyFacade("classpath:application.properties");
    }

applicationContext.xml

<!-- Property Configurer -->
<bean id="propertyFacade"
    class="com.konecta.utils.properties.PropertyFacade">
    <constructor-arg
        value="classpath:application.properties"></constructor-arg>
</bean>


<!-- MGA y Content Manager -->
<import resource="appCtxClientesServiciosWeb.xml" />
2
  • Pon el código de IContentManagerService y su implementación. el 25 may. 2021 a las 14:54
  • @PabloFradua es una interfaz externa , no tengo acceso a ella
    – melolo
    el 25 may. 2021 a las 14:58

1 respuesta 1

1

Si esa interfaz externa forma parte de una librería de Spring, y su implementación está anotada con @Service o @Component, podría valerte con añadir el paquete correspondiente en los paquetes a inspeccionar en el @ComponentScan de tu clase AppConfig.

En caso contrario, tendrás que crear un método anotado con @Bean, tal y como haces con PropertyFacade, para que el @Autowired de IContentManagerService en ContentManager sepa cómo inyectar el objeto que necesitas.

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.