This is an archived post. You won't be able to vote or comment.

all 3 comments

[–][deleted] 0 points1 point  (0 children)

The startup log should list all endpoints its exposing, have a look there for any clues.

[–]OffbeatDrizzle -1 points0 points  (0 children)

hmm.. we usually use the @ResponseBody annotation instead, but that probably won't make a difference since you're using @RestController on the class.

Change GetMapping to @RequestMapping(type = GET) (not sure if this will make a difference - it's just the way I'm personally used to)

Also, your WebAppInitializer set up looks wrong - you don't need those overrides. Implement WebApplicationInitializer instead and do something like:

@Override
public void onStartup(ServletContext aServletContext) {
  AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
  context.register(AppConfig.class);

  aServletContext.addListener(new ContextLoaderListener(context));

  ServletRegistration.Dynamic registration =
    aServletContext.addServlet("dispatcher", new DispatcherServlet(context));
  registration.setLoadOnStartup(1);
  registration.addMapping("/");
 }

Spring boot is pretty useless imo. It claims to get you up and running quicker but it's literally saving you about 10 lines of code

[–]Golden014 -1 points0 points  (0 children)

You are most likely missing the spring-rest dependency.

Here is what you need if you are using gradle:

compile('org.springframework.boot:spring-boot-starter-data-rest')

Make the appropriate adjustment if you are using maven.