public static Type[] getEnvironmentRepositoryFactoryTypeParams(
			ConfigurableListableBeanFactory beanFactory, String factoryName) {
		MethodMetadata methodMetadata = (MethodMetadata) beanFactory
				.getBeanDefinition(factoryName).getSource();
		Class<?> factoryClass = null;
		try {
			factoryClass = Class.forName(methodMetadata.getReturnTypeName());
		}
		catch (ClassNotFoundException e) {
			throw new IllegalStateException(e);
		}
		Optional<AnnotatedType> annotatedFactoryType = Arrays
				.stream(factoryClass.getAnnotatedInterfaces()).filter(i -> {
					ParameterizedType parameterizedType = (ParameterizedType) i.getType();
					return parameterizedType.getRawType()
							.equals(EnvironmentRepositoryFactory.class);
				}).findFirst();
		ParameterizedType factoryParameterizedType = (ParameterizedType) annotatedFactoryType
				.orElse(factoryClass.getAnnotatedSuperclass()).getType();
		return factoryParameterizedType.getActualTypeArguments();
	}
public static Type [ ] getEnvironmentRepositoryFactoryTypeParams ( ConfigurableListableBeanFactory beanFactory , String factoryName ) { MethodMetadata methodMetadata = ( MethodMetadata ) beanFactory . getBeanDefinition ( factoryName ) . getSource ( ) ; Class < ? > factoryClass = null ; try { factoryClass = Class . forName ( methodMetadata . getReturnTypeName ( ) ) ; } catch ( ClassNotFoundException e ) { throw new IllegalStateException ( e ) ; } Optional < AnnotatedType > annotatedFactoryType = Arrays . stream ( factoryClass . getAnnotatedInterfaces ( ) ) . filter ( i -> { ParameterizedType parameterizedType = ( ParameterizedType ) i . getType ( ) ; return parameterizedType . getRawType ( ) . equals ( EnvironmentRepositoryFactory . class ) ; } ) . findFirst ( ) ; ParameterizedType factoryParameterizedType = ( ParameterizedType ) annotatedFactoryType . orElse ( factoryClass . getAnnotatedSuperclass ( ) ) . getType ( ) ; return factoryParameterizedType . getActualTypeArguments ( ) ; }
Given a Factory Name return the generic type parameters of the factory (The actual
repository class, and its properties class).
@param beanFactory Spring Bean Factory
@param factoryName name of the factory
@return generic type params of the factory