Springboot Persisting Authentication on different Catalog

Viewed 16

I'm using SpringBoot and enabled a persistent authentication mechanism by setting

@Bean
public PersistentTokenRepository persistentTokenRepository()
{
    JdbcTokenRepositoryImpl tokenRepo = new JdbcTokenRepositoryImpl();
    tokenRepo.setDataSource(dataSource);
    return tokenRepo;
}

Now, dataSource has two catalogs, namely "data" and "useraccount". By default PersistentTokenRepository looks on the main catalog that is "data" but I want to select "useraccount" to store the "persistent_logins" table. Hence, I write:

@Entity(name="PersistentLogin")
@Table(name = "persistent_logins", catalog = "useraccount")
@Data
public class PersistentLogin implements Serializable
{  
 @Id
 private String series;
 private String username;
 private String token;
 private Timestamp last_used;  
}

The problem is that "persistent_logins" is always searched in the main catalog. Is there any way to change this setting?

1 Answers

I solved by overring Solved by overridding JdbcTokenRepositoryImpl.java and modifying as desired.

Related