Skip to content

Spring-Data-Commons 1.13.1-RELEASE causes custom repo to not be called. #77

Open
@ryonday

Description

@ryonday

I've spent a few hours on this bug and have tracked down the root cause, but am still searching for a workaround/solution.

  • spring-data-dynamoDB version: 4.5.0
  • Spring-data-commons version: 1.13.1-RELEASE

I have a base repository interface:

package com.foo.repository;
import com.foo.stuff.Foo;
import org.springframework.data.repository.CrudRepository;
public interface FooRepository extends CrudRepository<Foo, Long>, FooRepositoryCustom{}

...and a custom repository interface:

package com.foo.repository;
import com.foo.stuff.Foo;
public interface UserRepositoryCustom {
    Foo doNonstandardThing(Foo foo);
}

... and a custom repository implementation:

package com.foo.repository.impl;
import com.foo.stuff.Foo;
public class UserRepositoryImpl implements UserRepositoryCustom {
    public Foo save(Foo foo) {
        // Do things
    }
    public Foo doNonstandardThing(Foo foo){}
}

... If I use this custom repository:

package com.foo.service;
import com.foo.stuff.Foo;
import com.foo.stuff.Bar;

@Service
public class FooService {
    private final FooRepository fooRepo;
    
    @Autowired
    public FooService(FooRepository fooRepo) {
        this.fooRepo = fooRepo;
    }

    public Bar processFoo(Foo foo) {
        fold(foo);
        spindle(foo);      
        mutilate(foo);
        fooRepo.save(foo);
    }
}

With spring-data-dynamodb:4.2.3 using spring-data-commons:1.11.4-RELEASE, the fooRepo::save call in FooService would call the save method on FooRepositoryCustom. with spring-data-dynamodb:4.5.0 and spring-data-commons:1.13.1-RELEASE, it actually calls org.socialsignin.spring.data.dynamodb.repository.support.SimpleDynamoDBCrudRepository::save!

I've tracked this down to this commit and a few other changes within DefaultRepositoryInformation and specifically, the parametersMatch method.

What I can't figure out is why exactly the SimpleDynamoDBCrudRepository::save method is overriding my custom repository.

EDIT: Correct some Markdown

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions