Skip to content

Bean Error: Consider defining a bean of type 'org.springframework.session.FindByIndexNameSessionRepository' #2

@sumsood

Description

@sumsood

When I am using it with Spring boot version 1.5.7, I am getting below error

Description: Field sessionRepository in nl.trifork.App required a bean of type 'org.springframework.session.FindByIndexNameSessionRepository' that could not be found.
Action: Consider defining a bean of type 'org.springframework.session.FindByIndexNameSessionRepository' in your configuration.

using it in APP.java in below manner

   @Autowired
private FindByIndexNameSessionRepository<ExpiringSession> sessionRepository;
    @Bean
SpringSessionBackedSessionRegistry sessionRegistry() {
	return new SpringSessionBackedSessionRegistry<ExpiringSession>(
			this.sessionRepository);
}
  @Override
protected void configure(HttpSecurity http) throws Exception {
    //@formatter:off
    http.formLogin().and()
        .logout().and()
        .csrf().disable()
        .sessionManagement()
            .maximumSessions(2)
                .sessionRegistry(sessionRegistry())
                // set to true to prevent logins after reaching max sessions:
                .maxSessionsPreventsLogin(false)
                .and()
            .and()
        .authorizeRequests()
            .antMatchers("/").authenticated();
    //@formatter:on
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions