2016-08-07 2 views
1

Я пытаюсь вызвать покоя конечной точки, но получить эту информацию, когда я называю его, что приводит к ошибке 404 в UIНе нашли метод обработчика

2016-08-07 13:43:42.611 DEBUG 27834 --- [   main] s.w.s.m.m.a.RequestMappingHandlerMapping : Looking up handler method for path /api/v1/operations 
2016-08-07 13:43:42.614 DEBUG 27834 --- [   main] s.w.s.m.m.a.RequestMappingHandlerMapping : Did not find handler method for [/api/v1/operations] 
2016-08-07 13:43:42.615 DEBUG 27834 --- [   main] o.s.w.s.handler.SimpleUrlHandlerMapping : Matching patterns for request [/api/v1/operations] are [/**] 
2016-08-07 13:43:42.616 DEBUG 27834 --- [   main] o.s.w.s.handler.SimpleUrlHandlerMapping : URI Template variables for request [/api/v1/operations] are {} 
2016-08-07 13:43:42.617 DEBUG 27834 --- [   main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapping [/api/v1/operations] to HandlerExecutionChain with handler [ResourceHttpRequestHandler [locations=[ServletContext resource [/], class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/]], resolvers=[[email protected]ead1b7]]] and 1 interceptor 

Есть два класса контроллера в одном пакете с другая конечная точка

@RestController 
public class OperationRetrievalController { 

    @Autowired 
    OperationRetrievalManager operationRetrievalManager; 

    private static Logger logger = Logger.getLogger(OperationRetrievalController.class); 

    @RequestMapping("/api/v1/operations") 
    public ResponseEntity<List<OperationView>> requestUserOperations() { 
     String ssoId = "xxxxxx"; 
     logger.info("Inside request operationRetrivel Manager +++++++++>>>>>>>>"); 
     return new ResponseEntity<List<OperationView>>(operationRetrievalManager.retrieveOperations(ssoId), HttpStatus.OK); 
    } 


} 

у меня есть еще один класс в том же пакете:

@RestController 
public class ComponentRetrievalController { 

    @Autowired 
    ComponentRetrievalManager componentRetrievalManager; 

    @RequestMapping(value = "api/v1/component/{sso_id}" , method=RequestMethod.GET) 
    public ResponseEntity<List<Component>> requestUserComponent(@PathVariable("sso_id") String ssoId) { 

     return new ResponseEntity<List<Component>>(componentRetrievalManager.retrieveComponents(ssoId), HttpStatus.OK); 
    } 


} 

Вот весна загрузки приложения класс:

@SpringBootApplication 
@EnableAutoConfiguration 
@EnableJpaRepositories(basePackages="com.ge.power.bis.repositories") 
@ComponentScan(basePackages="com.ge.power.bis.managers") 
public class Application { 

    private static Logger logger = Logger.getLogger(Application.class); 


    public static void main(String[] args) { 


     SpringApplication springApplication = new SpringApplication(Application.class); 

     ApplicationContext ctx = springApplication.run(args); 

     logger.info("Let's inspect the beans provided by Spring Boot:"); 
     String[] beanNames = ctx.getBeanDefinitionNames(); 
     Arrays.sort(beanNames); 
     for (String beanName : beanNames) 
     { 
      logger.info(beanName); 
     }  
    } 
} 

Вот структура моего пакета Package structure

Когда я удалить все аннотации в Application.java и просто держа @SpringBootApplication, он дает следующее сообщение об ошибке:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'componentRetrievalController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.ge.power.bis.managers.ComponentRetrievalManager com.ge.power.bis.controllers.ComponentRetrievalController.componentRetrievalManager; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.ge.power.bis.managers.ComponentRetrievalManager] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapable 
+0

, что это адрес, который вы попытались вызвать – kuhajeyan

+0

http: // localhost: 8080/api/v1/операции во время работы в качестве приложения для загрузки весны в локальном – sromit

+0

В каком пакете указан 'ComponentRetrievalController'? Он должен быть в 'com.ge.power.bis.managers' или одном из его подпакетов. – Mubin

ответ

0

@Service отсутствовал на одном из класса Impl

Смежные вопросы