Spring Boot Security with Jdbc Annotation
<p><strong>WebSecurityConfig.java</strong></p>

<pre><code>@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter{

    @Autowired
    DataSource dataSource;

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests().antMatchers("/css/**", "/icons/**", "/js/**", "/images/**").permitAll();
        http.authorizeRequests().antMatchers("/bootstrap/**", "/icons/**", "/datatables/**", "/jquery/**",
                "/font-awesome/**", "/select2/**").permitAll();
        http.authorizeRequests().antMatchers("/", "/")
                                .permitAll()
                                .anyRequest()
                                .authenticated()
                                .and().formLogin()
                                .loginPage("/userForm")
                                .usernameParameter("userName").passwordParameter("password")
                                .defaultSuccessUrl("/login")
                                .failureUrl("/userForm")
                                .permitAll().and()
                                .logout().logoutUrl("/logout")
                                .logoutSuccessUrl("/logout").permitAll();
    }

    @Autowired
    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
        auth.jdbcAuthentication().dataSource(dataSource)
            .usersByUsernameQuery(
                "select username, password, active_status from bgtool_test_users where username = ? and active_status = 'Y'")
            .authoritiesByUsernameQuery(
                    "select username, role from bgtool_test_users where username = ?")
            .passwordEncoder(passwordEncoder())
            ;
   }

    @Bean
    public PasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder();
    }
}
</code></pre>

<p><strong>UserController.java</strong></p>

<pre><code>@Controller
public class UserController {
private final Logger logger = LoggerFactory.getLogger(UserController.class);

@Autowired
private GameFacade gameFacade;

@RequestMapping("/userList")
public String list(Model model) {
    List&lt;User&gt; users = gameFacade.findAllUsers();

    model.addAttribute("users", users);
    logger.debug("Users: {}", users);

    return "userList";
}

@RequestMapping(value = "/userForm", method = RequestMethod.GET)
public String userForm(Model model) {

    User entry = new User();
    model.addAttribute("userLogin", entry);
    logger.debug("Login Form");
    return "loginForm";
}

@RequestMapping(value = "/login", method = RequestMethod.POST)
public String login(@Valid @ModelAttribute("userLogin") User entry, BindingResult result, Model model) {
    System.out.println("setting status N");
    if (result.hasErrors()) {
        logger.debug("Login Form validation error");
        return "loginForm";
    } else {
        entry = gameFacade.findUserByName(entry.getUserName(), entry.getPassword());
        if (entry == null) {
            result.rejectValue("password", "error.userLogin", "Username or Password incorrect !!");
            return "loginForm";
        }
        logger.debug("Login Successful", entry);
        return "home";
    }
}
</code></pre>

<p><strong>pom.xml</strong></p>

<pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;

&lt;groupId&gt;frau&lt;/groupId&gt;
&lt;artifactId&gt;bgtweb&lt;/artifactId&gt;
&lt;packaging&gt;jar&lt;/packaging&gt;
&lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;

&lt;parent&gt;
    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
    &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
    &lt;version&gt;1.4.0.RELEASE&lt;/version&gt;
&lt;/parent&gt;

&lt;properties&gt;
    &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
    &lt;java.version&gt;1.8&lt;/java.version&gt;
    &lt;derby.version&gt;10.12.1.1&lt;/derby.version&gt;
&lt;/properties&gt;

&lt;dependencies&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
        &lt;artifactId&gt;spring-boot-starter-thymeleaf&lt;/artifactId&gt;
    &lt;/dependency&gt;

    &lt;dependency&gt;
        &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
        &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
    &lt;/dependency&gt;

    &lt;dependency&gt;
        &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
        &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt;
    &lt;/dependency&gt;

    &lt;dependency&gt;
        &lt;groupId&gt;commons-dbcp&lt;/groupId&gt;
        &lt;artifactId&gt;commons-dbcp&lt;/artifactId&gt;
        &lt;version&gt;${commons-dbcp.version}&lt;/version&gt;
    &lt;/dependency&gt;

    &lt;dependency&gt;
        &lt;groupId&gt;org.apache.derby&lt;/groupId&gt;
        &lt;artifactId&gt;derbyclient&lt;/artifactId&gt;
        &lt;version&gt;${derby.version}&lt;/version&gt;
        &lt;scope&gt;runtime&lt;/scope&gt;
    &lt;/dependency&gt;

&lt;!-- SPRING SECURITY --&gt;
         &lt;dependency&gt;
                &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
                &lt;artifactId&gt;spring-security-web&lt;/artifactId&gt;
         &lt;/dependency&gt;
         &lt;dependency&gt;
                &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
                &lt;artifactId&gt;spring-security-config&lt;/artifactId&gt;
         &lt;/dependency&gt;
         &lt;dependency&gt;
                &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                &lt;artifactId&gt;spring-boot-starter-security&lt;/artifactId&gt;
         &lt;/dependency&gt;

         &lt;!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-core --&gt;
         &lt;dependency&gt;
                &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
                &lt;artifactId&gt;spring-security-core&lt;/artifactId&gt;
         &lt;/dependency&gt;


&lt;/dependencies&gt;

&lt;build&gt;
    &lt;plugins&gt;
        &lt;plugin&gt;
            &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
            &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
        &lt;/plugin&gt;

        &lt;plugin&gt;
            &lt;groupId&gt;org.jheinzel.maven&lt;/groupId&gt;
            &lt;artifactId&gt;derby-maven-plugin&lt;/artifactId&gt;
            &lt;version&gt;1.0&lt;/version&gt;
            &lt;configuration&gt;
                &lt;derbyHome&gt;${project.basedir}/data&lt;/derbyHome&gt;
                &lt;port&gt;1527&lt;/port&gt;
                &lt;database&gt;EMDb&lt;/database&gt;
            &lt;/configuration&gt;
        &lt;/plugin&gt;

    &lt;/plugins&gt;
&lt;/build&gt;

&lt;/project&gt;
</code></pre>

<p>When i try to login, i am redirected back to loginform page. The controller method for mapping "/login" is not getting called as i am not getting my logger messages of same method in the console. 
I have checked the SQL queries.they are correct.I am unable to find what is missing.
Any help is appreciated. Thanks in Advance </p>