/** * Returns the bean implementation class for the given bean name. * * @param name the bean name * @return a bean implementation class */ public Class<?> getBeanClass(String name) { if (applicationContext == null) { throw new IllegalStateException("Attempt to access a bean before the Spring component has been started: " + name); } String beanClassName = applicationContext.getBeanDefinition(name).getBeanClassName(); try { return classLoader.loadClass(beanClassName); } catch (ClassNotFoundException e) { // this should not happen at this point throw new AssertionError(e); } }
/** * Returns the bean implementation class for the given bean name. * * @param name the bean name * @return a bean implementation class */ public Class<?> getBeanClass(String name) { if (applicationContext == null) { throw new IllegalStateException("Attempt to access a bean before the Spring component has been started: " + name); } String beanClassName = applicationContext.getBeanDefinition(name).getBeanClassName(); try { return classLoader.loadClass(beanClassName); } catch (ClassNotFoundException e) { // this should not happen at this point throw new AssertionError(e); } }
/** * Returns the bean implementation class for the given bean name. * * @param name the bean name * @return a bean implementation class */ public Class<?> getBeanClass(String name) { if (applicationContext == null) { throw new IllegalStateException("Attempt to access a bean before the Spring component has been started: " + name); } String beanClassName = applicationContext.getBeanDefinition(name).getBeanClassName(); try { return classLoader.loadClass(beanClassName); } catch (ClassNotFoundException e) { // this should not happen at this point throw new AssertionError(e); } }