What is the secure and efficient way of storing files uploaded by user in Spring Project?
You should take a look at the community/companion project Spring Content.
If you are familiar with Spring Data then this project is for unstructured data (i.e. documents, images, videos, etc) what Spring Data is for structured data.
Like Spring Data, it provides a simple, labor-saving programming interface that allows you very quickly and easily create REST APIs for uploading/downloading content, associating that content with Spring Data entities should you want to, and managing it all on the filesystem, or as BLOBs in the database, or in the cloud in something like S3.
Spring Content will provide a programming/modeling framework that should enable you to easily create a content management site with its content behind a paywall.