I am trying to call external jar methods from spring boot application. But the external jar is a xml based spring framework.
package com.ext.beans;
public class ExtBean{
extMethod() {
// some action
};
}
in application-context.xml
<bean id="extBean" class="com.ext.beans.ExtBean" scope="prototype"/>
My Spring boot application:
@Configuration
@ComponentScan({"com.ext.beans"})
public class ParentConfig {
@Bean("extBean")
public ExtBean extBean() {
return new ExtBean();
}
}
@Service
public class ParentService {
@Autowired
@Qualifier("extBean")
ExtBean extBean;
public ParentServiceMethod() {
//perform function with extBean method
extBean.extMethod();
}
}
spring boot application is fail start the application getting below error
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'parentService': Unsatisfied dependency expressed through field 'extBean'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'extBean' defined in class path resource [com/parent/config/ParentConfig.class]
FYI: i have added the external jar dependency in spring boot pom.xml