0

I am trying to add BCrypt to my code, but my program won't import the dependency. All I get is the message "Cannot resolve symbol 'BCrypt'" and if I try to look at the informationsymbol, my only alternatives are:

  • "Create class 'BCrypt'"
  • "Create field 'BCrypt' in 'JavaclassName'"
  • "Create local variable 'BCrypt'" and so on...

I tried adding dependency in the pom.xml-file:

<dependency>
   <groupId>org.springframework.security</groupId>
   <artifactId>spring-security-core</artifactId>
   <version>5.4.6</version>
</dependency>

but it did not help. I also tried:

<dependency>
    <groupId>org.mindrot</groupId>
    <artifactId>jbcrypt</artifactId>
    <version>0.4</version>
</dependency>

but this just gave me red warnign-signs.

I use Intellij, and started a Spring project with SDK java version 11. Hope someone is able to help :)

Jenny L
  • 3
  • 2
  • Can you provide the code where you are getting the error? – Rukshan Jayasekara May 21 '21 at 16:14
  • What import statement are you using? – f1sh May 21 '21 at 16:14
  • I think it's an IDE issue, I often experience this kind of problem with the last releases of IntelliJ. I don't know why but the last versions of IntelliJ Ultimate (since 2020.1) seem really instable. To solve it, check your module SDK (not the project SDK) sometimes they are not the same. Also, you can invalidate the cache and restart. – akuma8 May 21 '21 at 16:33

2 Answers2

1

Could you try with

<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-crypto</artifactId>
<version>5.4.6</version>
Shriraj
  • 56
  • 4
0

The following dependency works for me.

Try adding this, refreshing maven dependencies and restarting your IDE.

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
Renis1235
  • 4,116
  • 3
  • 15
  • 27