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

error RequestMapping annotaion not found after adding spring-boot-starter-thymeleaf dependency

i replace >spring-boot-starter-web dependency with >spring-boot-starter-thymeleaf dependency then there is error at compile time of RequestMapping annotaion.If i include both then i get following error
Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback. How to resolve it.

1 Answer

Looks like they now not include the spring-boot-starter-web dependency, so add it manually.

...
dependencies {
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-thymeleaf', version: '2.0.0.RELEASE'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.0.0.RELEASE'
}
...
Qasa Lee
Qasa Lee
18,916 Points

It works! Thank you!