0

It seems when I add the dependency for the spring-hateoas

<groupId>org.springframework.hateoas</groupId>
    <artifactId>spring-hateoas</artifactId>
    <version>0.13.0.RELEASE</version>

The Class below is no longer available on the classpath

org.springframework.web.bind.annotation.RestController;

I have tried to exclude various dependencies for the spring-hateoas but the APP no longer runs.

Has anyone had any luck running spring-hateoas within spring boot.

Laza
  • 91
  • 1
  • 8

1 Answers1

1

Absolutely no problem whatsoever. The @RestController annotation is still available and you shouldn't need to do any exclusion.

In case it helps, I'm currently using version 1.0.2 of Spring Boot:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.0.2.RELEASE</version>
</parent>

spring-boot-starter-web provides the @RestController:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>

I don't define an explicit version for spring-hateoas in my pom.xml, but my build is pulling in 0.9.0.RELEASE:

<dependency>
    <groupId>org.springframework.hateoas</groupId>
    <artifactId>spring-hateoas</artifactId>
</dependency>

As a side note, I can see from the Eclipse POM editor, that Spring HATEOAS is defining dependencies on Spring 3.2.7. However the spring-boot-starter-parent project manages the versions up to 4.0.3. Can you see what version of Spring you are getting? Have you perhaps not used the spring-boot-parent as a parent project?

Steve
  • 9,270
  • 5
  • 47
  • 61