@@ -55,7 +55,11 @@ public String getGeneralProp( String key ) {
5555 }
5656
5757 public static DaogenCatalogConfig loadConfig ( InputStream input ) throws ConfigException {
58- return loadConfig ( input , DaogenCatalogConfig .class );
58+ return loadConfig (input , DaogenCatalogConfig .class , null );
59+ }
60+
61+ public static DaogenCatalogConfig loadConfig ( InputStream input , Properties overrideProperties ) throws ConfigException {
62+ return loadConfig ( input , DaogenCatalogConfig .class , overrideProperties );
5963 }
6064
6165 private static void loadGeneratorCatalog ( DaogenCatalogConfig config , Class <?> c ) throws ConfigException {
@@ -81,9 +85,26 @@ private static void loadGeneratorCatalog( DaogenCatalogConfig config, Class<?> c
8185 }
8286
8387 public static DaogenCatalogConfig loadConfig ( InputStream input , Class <?> c ) throws ConfigException {
88+ return loadConfig (input , c , null );
89+ }
90+
91+ public static DaogenCatalogConfig loadConfig ( InputStream input , Class <?> c , Properties overrideProperties ) throws ConfigException {
8492 DaogenCatalogConfig config = new DaogenCatalogConfig ();
8593 try {
8694 load ( input , config );
95+ // override properties START
96+ if ( overrideProperties != null ) {
97+ config .getLogger ().info ( "override properties -> {}" , overrideProperties );
98+ for ( Object k : overrideProperties .keySet () ) {
99+ String key = k .toString ();
100+ String value = overrideProperties .getProperty (key );
101+ config .getLogger ().info ( "ovverride {} -> {}" , key , value );
102+ config .getGeneralProps ().setProperty (key , value );
103+ }
104+ config .getGeneralProps ().keySet ().stream ().sorted ().forEach (
105+ k -> config .getLogger ().info ( "prop key : {} value : {}" , k , config .getGeneralProps ().getProperty ( k .toString () ) ) );
106+ }
107+ // override properties END
87108 // class config
88109 String classConfigPath = config .getGeneralProps ().getProperty ( DaogenCatalogConstants .GEN_PROP_CLASS_CONFIG , DaogenCatalogConstants .GEN_PROP_CLASS_CONFIG_DEFAULT );
89110 try ( InputStream is = StreamHelper .resolveStream ( classConfigPath , null , c ) ) {
0 commit comments