I am new to MongoDB and I am trying to use it with my SpringBoot application. I have followed my tutorials online and have downloaded their code and got it execute.
However for whatever reason my project fails to be able to print out RequestMappingHandlerMapping : Mapped “{[/findAllBooks/{id}],methods=[GET]}”
I was wondering if anyone would be able to advise me if it is due to the nature of my project structure . I wasn’t sure if my SpringBootMain could see my Controller class.
My project structure is best viewed here https://github.com/emuldrew855/backend/tree/A/B-Testing/src/main/java/com/ebay/queens/demo
My Controller class
package com.ebay.queens.demo.resource;
@RestController
@RequestMapping("/v2")
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;
}
}
My main class
package com.ebay.queens.demo;
@SpringBootConfiguration
@SpringBootApplication
public class SpringBootMain implements CommandLineRunner {
@Autowired
private TokenUtilityClass tokenUtilityClass;
@Bean ResourceConfig resourceConfig() {
return new ResourceConfig().registerClasses(Version1Api.class, Login.class, SignUp.class, Paypal.class); }
@Override
public void run(String... args) throws Exception {
// test.authenticationToken();
}
public static void main(String[] args) {
SpringApplication.run(SpringBootMain.class, args);
}
}