SpringBoot не может найти метод-обработчик для регистрации запросов mongdb - PullRequest
0 голосов
/ 03 марта 2020

У меня есть приложение с весенней загрузкой, которое пытается подключиться к базе данных Mon go, однако ни один из моих запросов не отображается. Мой консольный журнал выглядит следующим образом.

2020-03-03 16:48:57.866  INFO 2100 --- [           main] com.ebay.queens.demo.SpringBootMain      : Starting SpringBootMain on DESKTOP-BJ4TA7J with PID 2100 (started by user in C:\Users\user\Documents\Beng Software Engineering\CSC3032-Software Engineering Project\backend)
2020-03-03 16:48:57.872  INFO 2100 --- [           main] com.ebay.queens.demo.SpringBootMain      : No active profile set, falling back to default profiles: default
2020-03-03 16:48:59.428  INFO 2100 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2020-03-03 16:48:59.488  INFO 2100 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 49ms. Found 0 repository interfaces.
2020-03-03 16:49:02.977  INFO 2100 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 9000 (http)
2020-03-03 16:49:03.094  INFO 2100 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2020-03-03 16:49:03.095  INFO 2100 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.26]
2020-03-03 16:49:03.468  INFO 2100 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2020-03-03 16:49:03.468  INFO 2100 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 5447 ms
2020-03-03 16:49:03.494  INFO 2100 --- [           main] com.ebay.queens.demo.TokenUtilityClass   : Token Utility Class
PRD-38907625e4e8-b6b8-4c83-b069-68ac
2020-03-03 16:49:03.577  INFO 2100 --- [          Timer] com.ebay.queens.demo.TokenUtilityClass   : Authentication Token
2020-03-03 16:49:04.369  INFO 2100 --- [           main] com.ebay.queens.demo.Login               : Login
2020-03-03 16:49:04.371  INFO 2100 --- [           main] com.ebay.queens.demo.SignUp              : SignUp
2020-03-03 16:49:05.453  INFO 2100 --- [          Timer] com.ebay.queens.demo.TokenUtilityClass   : A21AAEEVZG6qL6IdhIDPRgFdjGFi00knDwdZsJUdkPsKV9g9sI8Q7R0tv4PKtwV53KkUlagV6QsDI5T53RPb4bhJwUkIwb8Cg
2020-03-03 16:49:05.613  INFO 2100 --- [           main] org.mongodb.driver.cluster               : Cluster created with settings {hosts=[localhost:27017], mode=MULTIPLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
2020-03-03 16:49:05.613  INFO 2100 --- [           main] org.mongodb.driver.cluster               : Adding discovered server localhost:27017 to client view of cluster
2020-03-03 16:49:05.754  INFO 2100 --- [localhost:27017] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:1, serverValue:17}] to localhost:27017
2020-03-03 16:49:05.762  INFO 2100 --- [localhost:27017] org.mongodb.driver.cluster               : Monitor thread successfully connected to server with description ServerDescription{address=localhost:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[4, 2, 3]}, minWireVersion=0, maxWireVersion=8, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=5458000}
2020-03-03 16:49:05.764  INFO 2100 --- [localhost:27017] org.mongodb.driver.cluster               : Discovered cluster type of STANDALONE
2020-03-03 16:49:05.844  WARN 2100 --- [           main] o.s.data.convert.CustomConversions       : Registering converter from class java.time.LocalDateTime to class java.time.Instant as reading converter although it doesn't convert from a store-supported type! You might wanna check you annotation setup at the converter implementation.
2020-03-03 16:49:05.845  WARN 2100 --- [           main] o.s.data.convert.CustomConversions       : Registering converter from class java.time.Instant to class java.time.LocalDateTime as reading converter although it doesn't convert from a store-supported type! You might wanna check you annotation setup at the converter implementation.
2020-03-03 16:49:06.059  WARN 2100 --- [           main] o.s.data.convert.CustomConversions       : Registering converter from class java.time.LocalDateTime to class java.time.Instant as reading converter although it doesn't convert from a store-supported type! You might wanna check you annotation setup at the converter implementation.
2020-03-03 16:49:06.059  WARN 2100 --- [           main] o.s.data.convert.CustomConversions       : Registering converter from class java.time.Instant to class java.time.LocalDateTime as reading converter although it doesn't convert from a store-supported type! You might wanna check you annotation setup at the converter implementation.
2020-03-03 16:49:06.642  INFO 2100 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 9000 (http) with context path ''
2020-03-03 16:49:06.646  INFO 2100 --- [           main] com.ebay.queens.demo.SpringBootMain      : Started SpringBootMain in 9.677 seconds (JVM running for 10.521)
2020-03-03 16:49:06.648  INFO 2100 --- [           main] com.ebay.queens.demo.TokenUtilityClass   : Token Utility Class
2020-03-03 16:49:06.648  INFO 2100 --- [           main] com.ebay.queens.demo.Paypal              : Paypal Class
2020-03-03 16:49:06.653  INFO 2100 --- [           main] com.ebay.queens.demo.Version1Api         : Version 1 API

, и мой класс контроллера выглядит следующим образом

package com.ebay.queens.demo.resource;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.ebay.queens.demo.User;
import com.ebay.queens.repository.UserRepository;


@RestController
public class UserController {

    @Autowired
    private UserRepository userRepository;

    @PostMapping("/AddUser")
    public String saveUser(@RequestBody User user) {
        userRepository.save(user);
        return "Added user with id: " + user.getId();
    }

    @GetMapping("/all")
    public List<User> getAll(){
        List<User> users = this.userRepository.findAll();
        return users;
    }
}

Я пытался переставить пакеты, но безуспешно.

Есть ли у кого-нибудь предложения?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...