is there a way to list all beans contained in a di...
# fw1
j
is there a way to list all beans contained in a di/1 beanFactory?
w
getBeanFactory().getBeanInfo();
here's a method i have in application.cfc which carves up the beanpool into singletons and transients, which i use to dump that info on an app reinit page:
Copy code
private any function getBeanFactoryInfo( string subsystem = "" ) output=false {
		
		var beaninfo = {};
		var beanpool = getBeanFactory(arguments.subsystem).getBeanInfo().beanInfo;
		
		beaninfo = {
			"singletons" : [],
			"transients" : []
		};

		for( var b in beanpool ) {
			if( isstruct(beanpool[b]) && structkeyexists(beanpool[b],"isSingleton") ) {
				if( beanpool[b]["isSingleton"] ) {
					arrayappend(beaninfo.singletons,b);
				}
				else {
					arrayappend(beaninfo.transients,b);
				}
			}
		}

		arraysort(beaninfo.singletons,"textnocase","asc");
		arraysort(beaninfo.transients,"textnocase","asc");
		
		return beaninfo; 

	}
👍 1
j
cool, thanks, @websolete! i've run into this need in the past, too, but didn't solve it. i'll dig in with your suggestion next week.