I'm using the same schema from the url you put in your question. I'm using postgres, so I had to change some of the types (varchar -> character varying, LONGVARBINARY -> bytea). In addition to that my datasource is set up in a separate config class and looks like this:
@Bean
public DataSource dataSource() {
BoneCPDataSource dataSource = new BoneCPDataSource();
dataSource.setDriverClass("org.postgresql.Driver");
dataSource.setJdbcUrl("jdbc:postgresql://localhost/oauthDB");
dataSource.setUsername("my_username");
dataSource.setPassword("*****");
return dataSource;
}
I'm using the example provided in Sparklr2 (https://github.com/spring-projects/spring-security-oauth/tree/master/samples/oauth2/sparklr) so that I have the next class:
@Configuration
@EnableWebSecurity
public class OAuth2ServerConfig extends WebSecurityConfigurerAdapter {
@Autowired
private TokenStore tokenStore;
private static DataSource dataSource;
@Autowired
private void setDataSource(DataSource dataSourcee) {
dataSource = dataSourcee;
}
//... SOME MORE CODE ...
@Configuration
@Order(1)
protected static class AuthorizationServerConfiguration extends
OAuth2AuthorizationServerConfigurerAdapter {
private TokenStore tokenStore = new JdbcTokenStore(dataSource);
The rest of the code is almost the same as in Sparklr2