I have a scenario where I am running a large enterprise application.
- There I have a application without a @SpringBootApplication called XYZ Application.The application is not getting Autowired in ABC application which has @SpringBootApplication which I run in the Intellij.How do I make sure bean is created when I run the application.
Note: I have the jars of XYZ application as a gradle build.There are seperate jars for XYZ-api and XYZ-impl.
// XYZ-api
public interface LocationService{
}
//XYZ-impl
@Service("locationServiceImpl")
public class LocationServiceImpl implements LocationService{
@Resource
CountryDAO countryDAO;
}
//PQR (Some other jar file)
@Component
public class LocaleImpl implements Locale{
@Autowired
public LocationService locationService;
}
The error I get is "nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'localeImpl': Unsatisfied dependency expressed through field 'locationService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'LocationService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations:{@org.springframework.beans.factory.annotation.Autowired(required=true)}"
Also I have tried including the package for XYZ application,It does resolve the issue but the @Resource CountryDAO bean is not injected.Please help.