use of org.springframework.beans.factory.BeanCreationNotAllowedException in project spring-integration by spring-projects.
the class ManualFlowTests method testWrongIntegrationFlowScope.
@Test
public void testWrongIntegrationFlowScope() {
try {
new AnnotationConfigApplicationContext(InvalidIntegrationFlowScopeConfiguration.class).close();
fail("BeanCreationNotAllowedException expected");
} catch (Exception e) {
assertThat(e, instanceOf(BeanCreationNotAllowedException.class));
assertThat(e.getMessage(), containsString("IntegrationFlows can not be scoped beans."));
}
}
use of org.springframework.beans.factory.BeanCreationNotAllowedException in project irida by phac-nml.
the class ForbidJpqlUpdateDeletePostProcessor method postProcessAfterInitialization.
/**
* {@inheritDoc}
*/
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
if (beanName.endsWith("Repository") && bean instanceof EnversRevisionRepositoryFactoryBean) {
logger.trace("Found a repository class... [" + beanName + "]");
final EnversRevisionRepositoryFactoryBean factory = (EnversRevisionRepositoryFactoryBean) bean;
try {
final Iterable<Method> queryMethods = factory.getRepositoryInformation().getQueryMethods();
for (final Method queryMethod : queryMethods) {
if (queryMethod.isAnnotationPresent(Query.class) || queryMethod.isAnnotationPresent(Modifying.class)) {
final Query q = queryMethod.getAnnotation(Query.class);
final String queryValue = q.value().toLowerCase();
if (queryValue.contains("update") || queryValue.contains("delete")) {
throw new BeanCreationNotAllowedException(beanName, "Update and Delete are not allowed in JPQL because Envers doesn't audit those queries. Remove the update or delete from the method [" + queryMethod.getName() + "]");
}
}
}
} finally {
}
}
return bean;
}
Aggregations