use of org.springframework.boot.autoconfigure.condition.ConditionalOnClass in project camel by apache.
the class FtpComponentAutoConfiguration method configureFtpComponent.
@Lazy
@Bean(name = "ftp-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(FtpComponent.class)
public FtpComponent configureFtpComponent(CamelContext camelContext) throws Exception {
FtpComponent component = new FtpComponent();
component.setCamelContext(camelContext);
return component;
}
use of org.springframework.boot.autoconfigure.condition.ConditionalOnClass in project camel by apache.
the class GitHubComponentAutoConfiguration method configureGitHubComponent.
@Lazy
@Bean(name = "github-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(GitHubComponent.class)
public GitHubComponent configureGitHubComponent(CamelContext camelContext) throws Exception {
GitHubComponent component = new GitHubComponent();
component.setCamelContext(camelContext);
return component;
}
use of org.springframework.boot.autoconfigure.condition.ConditionalOnClass in project camel by apache.
the class JcrComponentAutoConfiguration method configureJcrComponent.
@Lazy
@Bean(name = "jcr-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(JcrComponent.class)
public JcrComponent configureJcrComponent(CamelContext camelContext) throws Exception {
JcrComponent component = new JcrComponent();
component.setCamelContext(camelContext);
return component;
}
use of org.springframework.boot.autoconfigure.condition.ConditionalOnClass in project camel by apache.
the class JdbcComponentAutoConfiguration method configureJdbcComponent.
@Lazy
@Bean(name = "jdbc-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(JdbcComponent.class)
public JdbcComponent configureJdbcComponent(CamelContext camelContext, JdbcComponentConfiguration configuration) throws Exception {
JdbcComponent component = new JdbcComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
IntrospectionSupport.getProperties(configuration, parameters, null, false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
if (paramClass.getName().endsWith("NestedConfiguration")) {
Class nestedClass = null;
try {
nestedClass = (Class) paramClass.getDeclaredField("CAMEL_NESTED_CLASS").get(null);
HashMap<String, Object> nestedParameters = new HashMap<>();
IntrospectionSupport.getProperties(value, nestedParameters, null, false);
Object nestedProperty = nestedClass.newInstance();
IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), nestedProperty, nestedParameters);
entry.setValue(nestedProperty);
} catch (NoSuchFieldException e) {
}
}
}
IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), component, parameters);
return component;
}
use of org.springframework.boot.autoconfigure.condition.ConditionalOnClass in project camel by apache.
the class JettyHttpComponentAutoConfiguration9 method configureJettyHttpComponent9.
@Lazy
@Bean(name = "jetty-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(JettyHttpComponent9.class)
public JettyHttpComponent9 configureJettyHttpComponent9(CamelContext camelContext, JettyHttpComponentConfiguration9 configuration) throws Exception {
JettyHttpComponent9 component = new JettyHttpComponent9();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
IntrospectionSupport.getProperties(configuration, parameters, null, false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
if (paramClass.getName().endsWith("NestedConfiguration")) {
Class nestedClass = null;
try {
nestedClass = (Class) paramClass.getDeclaredField("CAMEL_NESTED_CLASS").get(null);
HashMap<String, Object> nestedParameters = new HashMap<>();
IntrospectionSupport.getProperties(value, nestedParameters, null, false);
Object nestedProperty = nestedClass.newInstance();
IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), nestedProperty, nestedParameters);
entry.setValue(nestedProperty);
} catch (NoSuchFieldException e) {
}
}
}
IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), component, parameters);
return component;
}
Aggregations