[Vaadin 24] Custom UI class not being used

So I have an old v14 Project I want to upgrade to v24. It’s a plain Java project using Jakarta Servlets.
The main servlet was defined inside a custom UI class (as in extends Vaadin’s UI class), because it needs to override the init method for some things. That worked totally fine in v14. It recognized the custom UI class and used it for every UI instance. When debugging and checking the type of UI.getCurrent() in any of the project’s views, the returned UI was always an instance of that custom class.
Now in v24, it seems like it instantiates a custom UI in the Beginning, but then never uses it again. It apparently creates a default Vaadin UI instance at some point and uses that for all of the views. Which obviously renders the custom code in the custom UI class totally useless and thus prevents many things from working properly.

This change in behaviour doesn’t seem to be properly documented anywhere and I’m wondering if it’s possible to work around that or if I can only redo everything that depended on this functionality. I know, this approach is probably not best-practice anyways but it’s a pretty big legacy project and it would be helpful to at least get it running before redoing everything properly at some point.

I don’t think there are many resources available, I just remember old discussions years ago that extending UI was always discouraged and is not working anymore with 20+ if I remember correctly…

This old workaround could help if you just store data https://github.com/vaadin/flow/issues/10696#issuecomment-822463237

More information here as well https://github.com/vaadin/flow/issues/10696#issuecomment-823226267

Thank you so much! I didn’t come across this issue yet and it seems like there are some suggestions I didn’t try so far but might be just what I need.