Giter Site home page Giter Site logo

请问上传功能里面同时也集成了保存的功能,如果上传成功了,保存这时候失败了,想回滚,有什么方案吗? about x-file-storage HOT 7 CLOSED

UncleCatWu avatar UncleCatWu commented on May 26, 2024
请问上传功能里面同时也集成了保存的功能,如果上传成功了,保存这时候失败了,想回滚,有什么方案吗?

from x-file-storage.

Comments (7)

1171736840 avatar 1171736840 commented on May 26, 2024 1

循环依赖的话这样写

@Lazy
@Autowired
private FileStorageService fileStorageService;

独立与否看自己需求,合适最重要

from x-file-storage.

1171736840 avatar 1171736840 commented on May 26, 2024

直接在这个切面里面调用对应存储平台的删除方法就可以了

from x-file-storage.

UncleCatWu avatar UncleCatWu commented on May 26, 2024

了解,谢谢大佬😁

from x-file-storage.

1171736840 avatar 1171736840 commented on May 26, 2024

或者是在Recorder中捕获异常,直接调用对应存储平台的删除方法就可以了

from x-file-storage.

UncleCatWu avatar UncleCatWu commented on May 26, 2024

好的,还有一个问题想请教,下图中,如果我这样在这个类中同时实现FileRecorder,同时也引用FileStorageService、SpringFileStorageProperties的话,会报循环依赖,不过已经解决了,我是在想这个FileRecorder是不是可以独立出来,想听下大佬的想法
image

from x-file-storage.

UncleCatWu avatar UncleCatWu commented on May 26, 2024

就是不在上传的同时保存,这样也能在FileStorageAutoConfiguration里面也不用去初始化,这个保存功能能完全交给使用者自己去支配

from x-file-storage.

UncleCatWu avatar UncleCatWu commented on May 26, 2024

感谢大佬,暂时没什么问题了

from x-file-storage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.