Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Spring Basics Creating Controllers and Views Using Thymeleaf to Serve HTML

With thymeleaf dependency springboot annotations are not resolving

After changing the dependency to:

`dependencies {
compile 'org.springframework.boot:spring-boot-starter-thymeleaf'
 }`

gradle sync worked fine but all my annotations got set to unresolved

I am getting following errors:

> Task :compileJava FAILED error: package org.springframework.web.bind.annotation does not exist import org.springframework.web.bind.annotation.RequestMapping; error: cannot find symbol @RequestMapping("/list") ^ symbol: class RequestMapping location: class GifController

2 Answers

Adding both of the below dependencies solved my problem.

dependencies {
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.0.3.RELEASE'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-thymeleaf', version: '2.0.3.RELEASE'
}
Caleb Kleveter
Caleb Kleveter
Treehouse Moderator 37,862 Points

Hi Nafeez. I just wanted to let you know I marked your answer as the best answer. This lets other people know that the question has been answered. If you ever solve a problem you post on the forum, you can mark it as best answer.

Happy coding!

Martin Gallauner
Martin Gallauner
10,808 Points

Hey thank you!

I tried the same but I put the dependecys in the other order and it didn't worked!