Uploading files to AWS S3 By Java SpringBoot

This is a demo of uploading files to AWS S3 using Java SpringBoot.

First, we need to add the dependency of AWS S3:

Then add these configs in application.yml:

The accessKey, secretKey and bucket is nesscessary which can be found in aws’ admin dashboard. Continue reading

Reading files from SpringBoot resources folder

Reading files from a SpringBoot jar is something a little complex.

I had tried to read a file from springboot resources folder using java.io.File. This is the code:

And I got the FileNotFoundException :

Since there is no path like file:/data/www/htdocs/my-app/lib/my-app.jar!/BOOT-INF/class existed in my computer, I got the exception. Continue reading

SpringBoot Mybatis Insert null Fields

I’m using SpringBoot and MyBatis. When tried to insert/update some rows into a table, I got the fllowing:

The column remark in the table user was setted to NOT NULL, and the value of the column to insert was null. That’s why I received the error. Continue reading