I can not inject BCryptEncoder in linux but in windows

1

my spring mvc / security project can not initialize because there is a problem with the BCryptEncoder:

org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder]

The same code and environment (Intellij 2016, java 1.8, mySQL 5.7, tomcat 8, maven 3.3) works well on windows.

BCryptPasswordEncoder is called in my userService:

@Autowired
private BCryptPasswordEncoder bCryptPasswordEncoder;

BCryptPasswordEncoder is defined in my SecurityConfig:

@Bean
public PasswordEncoder passwordEncoder() {
    PasswordEncoder encoder = new BCryptPasswordEncoder();
    return encoder;
}

And in the pom.xml:

   <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-taglibs</artifactId>
        <version>3.2.3.RELEASE</version>
    </dependency>

If I navigate from Intellij to the definition of the class, I find it in my library folder.

I have no more clues. It is very strange that it works only in Windows and not in linux. Thanks in advance.

    
asked by Alesis Joan 24.11.2016 в 12:22
source

1 answer

0

I changed the attribute in the class, from

@Autowired
private BCryptPasswordEncoder bCryptPasswordEncoder;

by:

@Autowired
private PasswordEncoder bCryptPasswordEncoder;
    
answered by 25.11.2016 в 18:50