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

content-s3-spring-boot-starte and S3ObjectId #49

Closed
FeDLviv opened this issue Oct 24, 2018 · 2 comments
Closed

content-s3-spring-boot-starte and S3ObjectId #49

FeDLviv opened this issue Oct 24, 2018 · 2 comments

Comments

@FeDLviv
Copy link

FeDLviv commented Oct 24, 2018

Hi Paul.

Thank you so much for your hard work.

From API reference

Ultimately, the S3 store uses instances of S3ObjectId to identify and place content. It is therefore also possible to create S3 stores using this type as the @ContentID type.

My dependencies

  ...
  springBootVersion = '2.0.6.RELEASE'
  contentVersion = '0.3.0'
  ...
@Entity
@Data
public class FileEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;

    @Column(name = "description", length = 50)
    private String description;

    @ContentId
    private S3ObjectId contentId;
//    private String contentId;

//    @Bucket
//    private String bucket;

    @ContentLength
    private long contentLength;

    @Column(name = "mime_type", nullable = false, length = 100)
    private String contentMimeType;

}

But... when I change type object (String -> S3ObjectId)... I get an exception:
org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.util.UUID] to type [com.amazonaws.services.s3.model.S3ObjectId]

@paulcwarren
Copy link
Owner

paulcwarren commented Oct 24, 2018

I suspect you are hitting this because when using S3ObjectId as the @ContentId you are responsible for populating this yourself. This isn't clear in the docs so if it turns out to be this then we'll update the docs to be clearer.

Can you give that a go pls? Or does that not work for you in which case we might be abl to auto-generate an S3ObjectId by registering a custom S3ObjectIdReolver?

@FeDLviv
Copy link
Author

FeDLviv commented Oct 26, 2018

@ContentID you are responsible for populating this yourself.

Ahhh... Now I understand. Thanks for your reply.

Can you give that a go pls? Or does that not work for you in which case we might be abl to auto-generate an S3ObjectId by registering a custom S3ObjectIdReolver?

Generating unique UUID (@ContentID + String) - is fine by me.
I was just wondering about the logic of this annotation with S3ObjectId, how it works.

@FeDLviv FeDLviv closed this as completed Oct 26, 2018
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