The task is as follows: obtain a diff between the snapshot recorded on disk (an XML file) and the current database, and then store this diff to XML file
everything should work from @Configuration SpringBoot application:
@Bean
@Order(4)
public CommandLineRunner initEverithing(ResourceLoader resourceLoader) { ... and so on
To perform diff with a file (“offline” in Liquibase), you need to provide a snapshot of the database, not the changelog. You create this with the snapshot command, formatted as JSON.
You just take a snapshot in JSON format, and then when you run diff you specify that as the referenceURL argument, like offline:postgresql?snapshot=mysnapshot.json. The URL argument is for the database.
This method should work. You would need to write the contents of the OutputStream to disk as a temp file, and then use that in your offline URL that you pass to the diff command.