Implementation not working in Intellij

I have been working through the Java Web Development Course materials. I am working on password authentication. The book asks us to add “” to the build.gradle file, which I did with the following code: implementation ‘’

When I add “private static final BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();” as suggested, Intellij marks BCryptPassWordEncoder in red and cant import it. Even after I rebuild the project, it remains red and can’t find it. This is the case sometimes when I switch into the code that covers the same lessons as provided by the textbook.

However, when I close Intellij and reopen, everything works fine…no code has changed. What is happening and what might I do in order to not restart each time this issue occurs?