Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the configuration property typeKey to null value in AerospikeDataProperties for the AerospikeTypeAliasAccessor bean #23

Closed
mrozk opened this issue Jan 21, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@mrozk
Copy link
Contributor

mrozk commented Jan 21, 2021

Hi! For now the only way to setup AerospikeTypeAliasAccessor with typeKey=null is to redeclare bean.

@Bean
    public AerospikeTypeAliasAccessor aerospikeTypeAliasAccessor() {
        //we do not want to save @class field with type of document into Aerospike
        return new AerospikeTypeAliasAccessor(null);
    }

We can't send typeKey=null through configuration properties because the configuration spring.data.aerospike.typeKey=null is taking all values as string. Let's discuss the most appropriate variant for setting null on this configuration, and I would contribute this. It can be placeholder @null for example.

@Aloren
Copy link
Member

Aloren commented Jan 21, 2021

Setting it to spring.data.aerospike.typeKey=~ in yaml also doesn't work?

@Aloren
Copy link
Member

Aloren commented Jan 21, 2021

Okay, I've checked both ~ and null values -- both of them are parsed as an empty string. I've looked through the internet and this is what I found: spring-projects/spring-framework#19986
I suppose, this behaviour won't be changed in the nearest future, so we definitely need to have a workaround for that.

I was thinking about some dirty hack like:
return new AerospikeTypeAliasAccessor(typeKey.equals("") ? null : typeKey);. Need to discuss with the teammates.

@Aloren Aloren added the bug Something isn't working label Jan 21, 2021
@mrozk mrozk closed this as completed Jan 29, 2021
@mrozk
Copy link
Contributor Author

mrozk commented Jan 29, 2021

Resolved in the scope of #28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants