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

Can I autowire inject DynamodbTemplate? #275

Open
yjf27281181 opened this issue Dec 1, 2019 · 1 comment
Open

Can I autowire inject DynamodbTemplate? #275

yjf27281181 opened this issue Dec 1, 2019 · 1 comment

Comments

@yjf27281181
Copy link

I am trying to use the "Custom Repository implementations" feature. And I am following the code:
`
// Most important this class has to be named like the interface with an 'Impl' suffix
// https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.single-repository-behavior
public class DeviceValueRepositoryImpl implements DeviceValueAdditionRepository {

// Inject everything you want as this is created like a normal bean
@Autowired
DynamoDBTemplate dynamoDBTemplate;

@Override
public String fancyCustomMethod() {
    // custom code here

    DeviceValue dv = dynamoDBTemplate.load(DeviceValue.class, "42");
    if (dv == null) {
        return "Not found";
    } else {
        return dv.getTag();
    }
}

}
`

However, it seems the spring container does not contain dynamoDBTemplate. So how can I use dynamoDBTemplate in my own repository?

Specifications

  • Spring Data DynamoDB Version: 5.0.4
  • Spring Data Version: 2.0.9
  • AWS SDK Version:
  • Java Version: 1.8
  • Platform Details: windows10
@efenderbosch
Copy link

We are doing this. Inject DynamoDBOperations instead as that's the interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants