Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这是在 Spring 的异常处理程序中将一些数据保存在数据库中的好习惯吗?在我的数据库中,我有与外部系统集成的状态,如果在集成期间出现异常,我想将状态设置为错误。
是的。如果您将异常处理程序设计为业务层,我认为没有任何理由阻止您对数据库执行“保存数据”。异常处理程序作为服务 bean,然后在全局范围内注入是我在许多应用程序中看到的正常标准。