DATACOUCH-604 - Fix NPE when looking for Id field in interface.

This was failing with a repository for the domain object CouchbaseOAuth2AccessToken.
The following dependency is needed.

        <dependency>
            <groupId>org.springframework.security.oauth</groupId>
            <artifactId>spring-security-oauth2</artifactId>
            <version>2.4.1.RELEASE</version>
        </dependency>

package org.springframework.data.couchbase.domain;

import org.springframework.data.annotation.Id;
import org.springframework.data.couchbase.core.mapping.Document;
import org.springframework.data.couchbase.core.mapping.Field;
import org.springframework.security.oauth2.common.DefaultOAuth2AccessToken;
import org.springframework.security.oauth2.common.OAuth2AccessToken;

@Document(expiry = 30 * 24 * 60 * 60)
public class CouchbaseOAuth2AccessToken extends DefaultOAuth2AccessToken {

	private static final long serialVersionUID = 6537949925775752989L;

	@Id
	private String tokenId;

	@Field
	private String authentication;

	@Field
	private String authenticationKey;

	@Field
	private String clientId;

	@Field
	private String userName;

	// getters and setters omitted for brevity

	private CouchbaseOAuth2AccessToken() {
		this((String) null);
	}

	public CouchbaseOAuth2AccessToken(OAuth2AccessToken accessToken) {
		super(accessToken);
		this.tokenId = accessToken.getValue();
	}

	public CouchbaseOAuth2AccessToken(String value) {
		super(value);
		this.tokenId = value;
	}

}
This commit is contained in:
mikereiche
2020-09-14 16:57:00 -07:00
parent 59b6091f06
commit 10568a469f
2 changed files with 1 additions and 2 deletions

View File

@@ -16,7 +16,6 @@
package org.springframework.data.couchbase.core.mapping;
import org.springframework.data.annotation.Id;
import org.springframework.data.mapping.Association;
import org.springframework.data.mapping.MappingException;
import org.springframework.data.mapping.model.AnnotationBasedPersistentProperty;

View File

@@ -2,7 +2,7 @@
# If set to false, it is assumed that the host is managing the cluster and
# as a result no containers or anything will be spun up.
# Options: containerized, mocked, unmanaged
cluster.type=unmanaged
cluster.type=mocked
# Default configs for both cases
cluster.adminUsername=Administrator
cluster.adminPassword=password