spring - External Java Library issue with Autowiring and injecting bean -


i have created spring boot application managed maven. i'm retrieving company's library our maven repository.

in library, have service interface, not being annotated '@service':

public interface myservice {    //... } 

this service has 1 implementation :

public class defaultmyservice implements myservice {    //... } 

this library context managed old spring way (in applicationcontext.xml file). read normally, spring boot able find implementation if there's 1 in scope.

when try run "spring-boot:run" on project, fail following error :

no qualifying bean of type 'com.pharmagest.saml.samlservice' available: expected @ least 1 bean qualifies autowire candidate. dependency annotations: {@org.springframework.beans.factory.annotation.autowired(required=true)}

i tried:

  1. to add @componentscan on configuration class, including packages in error : @componentscan(basepackages={"com.mycompany.web", "com.mycompany.thelibrary.client.*", "com.mycompany.thelibrary.services.*"})
  2. to add bean definition in applicationcontext.xml (if add interface tells me can define it, heard spring can find default implementation if there 1 ?)
  3. to add library @ "runtime" in projects options
  4. to add library external resource not via maven

in cases can maven build can't run project. have advice me ? thanks!

  1. won't work defaultmyservice has no @component (or @service) annotation not detected.
  2. bean definition has concrete instance use defaultmyservice instead of interface. spring not detect understanding wrong
  3. and 4. not change adding dependencies without proper 1. or 2. nothing.

just add @bean configuration

@bean public defaultmyservice myservice() {     return new defaultmyservice(); } 

or import other libraries applicatiponcontext.xml should do.

@importresource("classpath:/applicationcontext.xml") 

add next @springbootapplication.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -