--- a/src/main/java/de/uapcore/lightpit/ModuleManager.java Sat May 09 14:37:15 2020 +0200 +++ b/src/main/java/de/uapcore/lightpit/ModuleManager.java Sat May 09 14:58:20 2020 +0200 @@ -192,20 +192,18 @@ try (Connection conn = db.getDataSource().get().getConnection()) { final ModuleDao dao = CoreDAOFactory.getModuleDao(db.getSQLDialect()); final List<Module> modules = dao.listAll(conn); - - final List<Menu> menu = modules - .stream() - .filter((mod) -> mod.isVisible()) - .collect(Collectors.mapping( - (mod) -> new Menu( - mod.getClassname(), - new ResourceKey( - registeredModules.get(mod.getClassname()).bundleBaseName(), - registeredModules.get(mod.getClassname()).menuKey()), - registeredModules.get(mod.getClassname()).modulePath()), - Collectors.toList()) - ); - return menu; + + return modules + .stream() + .filter(Module::isVisible) + .sorted(new Module.PriorityComparator()) + .map(mod -> new Menu( + mod.getClassname(), + new ResourceKey( + registeredModules.get(mod.getClassname()).bundleBaseName(), + registeredModules.get(mod.getClassname()).menuKey()), + registeredModules.get(mod.getClassname()).modulePath())) + .collect(Collectors.toList()); } catch (SQLException ex) { LOG.error("Unexpected SQLException when loading the main menu", ex); return Collections.emptyList();