use of org.springframework.beans.FatalBeanException in project chassis by Kixeye.
the class WebSocketMessageMappingRegistry method registerWebSocketActions.
@PostConstruct
public void registerWebSocketActions() throws BeansException {
String[] controllerBeanNames = beanFactory.getBeanNamesForAnnotation(WebSocketController.class);
if (controllerBeanNames != null && controllerBeanNames.length > 0) {
try {
for (String beanName : controllerBeanNames) {
BeanDefinition beanDef = beanFactory.getBeanDefinition(beanName);
Class<?> beanClass = Class.forName(beanDef.getBeanClassName());
for (Method method : beanClass.getMethods()) {
ActionMapping mapping = method.getAnnotation(ActionMapping.class);
if (mapping != null) {
if (mapping.value() != null && mapping.value().length > 0) {
Map<String, String> requirements = new HashMap<>();
if (mapping.propertyRequirements() != null) {
for (ActionPropertyRequirement requirement : mapping.propertyRequirements()) {
requirements.put(requirement.name(), requirement.value());
}
}
for (String action : mapping.value()) {
logger.info("Registering destination [{}] with handler [{}].", action, method.toString());
Map<String, WebSocketActionArgumentResolver> argumentResolverBeans = beanFactory.getBeansOfType(WebSocketActionArgumentResolver.class);
if (argumentResolverBeans != null && !argumentResolverBeans.isEmpty()) {
logger.info("Registering WebSocketActionArgumentResolver beans {} with action {}", Joiner.on(",").join(argumentResolverBeans.keySet(), action));
}
actions.put(action, new WebSocketAction(method, requirements, argumentResolverBeans == null ? null : argumentResolverBeans.values().toArray(new WebSocketActionArgumentResolver[argumentResolverBeans.size()])));
}
}
}
}
}
} catch (Exception e) {
throw new FatalBeanException("Unable to configure bean", e);
}
} else {
logger.warn("No WebSocketController beans defined.");
}
}
use of org.springframework.beans.FatalBeanException in project hevelian-activemq by Hevelian.
the class WebXBeanBrokerFactory method createApplicationContext.
@Override
protected ApplicationContext createApplicationContext(String uri) throws MalformedURLException {
Resource resource = Utils.resourceFromString(uri);
LOG.debug("Using " + resource + " from " + uri);
try {
return new ResourceXmlApplicationContext(resource) {
@Override
protected ConfigurableEnvironment createEnvironment() {
return new ReversePropertySourcesStandardServletEnvironment();
}
@Override
protected void initPropertySources() {
WebApplicationContextUtils.initServletPropertySources(getEnvironment().getPropertySources(), ServletContextHolder.getServletContext());
}
};
} catch (FatalBeanException errorToLog) {
LOG.error("Failed to load: " + resource + ", reason: " + errorToLog.getLocalizedMessage(), errorToLog);
throw errorToLog;
}
}
Aggregations