use of com.devonfw.cobigen.impl.aop.BeanFactory in project cobigen by devonfw.
the class CobiGenFactory method create.
/**
* Creates a new {@link CobiGen} while searching a valid configuration at the given path
*
* @param configFileOrFolder the root folder containing the context.xml and all templates, configurations etc.
* @return a new instance of {@link CobiGen}
* @throws InvalidConfigurationException if the context configuration could not be read properly.
*/
public static CobiGen create(URI configFileOrFolder) throws InvalidConfigurationException {
Objects.requireNonNull(configFileOrFolder, "The URI pointing to the configuration could not be null.");
ConfigurationHolder configurationHolder = new ConfigurationHolder(configFileOrFolder);
BeanFactory beanFactory = new BeanFactory();
beanFactory.addManuallyInitializedBean(configurationHolder);
CobiGen createBean = beanFactory.createBean(CobiGen.class);
// Notifies all plugins of new template root path
PluginRegistry.notifyPlugins(configurationHolder.getConfigurationPath());
return createBean;
}
Aggregations