public final Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { if (bean instanceof Catalog) { // ensure this is not a wrapper but the real deal if (bean instanceof Wrapper && ((Wrapper) bean).isWrapperFor(Catalog.class)) { return bean; } // load try { Catalog catalog = (Catalog) bean; XStreamPersister xp = xpf.createXMLPersister(); xp.setCatalog(catalog); loadCatalog(catalog, xp); // initialize styles initializeStyles(catalog, xp); } catch (Exception e) { throw new RuntimeException(e); } } if (bean instanceof GeoServer) { geoserver = (GeoServer) bean; try { XStreamPersister xp = xpf.createXMLPersister(); xp.setCatalog(geoserver.getCatalog()); loadGeoServer(geoserver, xp); // load initializers loadInitializers(geoserver); } catch (Exception e) { throw new RuntimeException(e); } // initialize(); } return bean; }