private void loadAliases ( ApplicationContext applicationContext , String propertyFile ) { if ( propertyFile . isEmpty ( ) ) { return ; } Resource [ ] resources ; try { resources = applicationContext . getResources ( propertyFile ) ; } catch ( IOException e ) { log . error ( "Failed to locate alias property file: " + propertyFile , e ) ; return ; } for ( Resource resource : resources ) { if ( ! resource . exists ( ) ) { log . info ( "Did not find alias property file: " + resource . getFilename ( ) ) ; continue ; } try ( InputStream is = resource . getInputStream ( ) ; ) { Properties props = new Properties ( ) ; props . load ( is ) ; for ( Entry < Object , Object > entry : props . entrySet ( ) ) { try { register ( ( String ) entry . getKey ( ) , ( String ) entry . getValue ( ) ) ; entryCount ++ ; } catch ( Exception e ) { log . error ( "Error registering alias for '" + entry . getKey ( ) + "'." , e ) ; } } fileCount ++ ; } catch ( IOException e ) { log . error ( "Failed to load alias property file: " + resource . getFilename ( ) , e ) ; } } }
Load aliases from a property file .