@Test
public void assertExistsPrivateCtor() {
reflections.getSubTypesOf(Object.class).stream()
.filter(clazz -> !clazz.isAnnotationPresent(Configuration.class))
.filter(clazz -> !clazz.isAnnotationPresent(Component.class))
.filter(clazz -> !clazz.isAnnotationPresent(SpringBootApplication.class))
.filter(clazz -> !clazz.getName().endsWith("Test"))
.filter(clazz -> !clazz.isInterface())
.filter(clazz ->
Arrays.stream(clazz.getDeclaredFields())
.allMatch(field -> Modifier.isStatic(field.getModifiers())))
.forEach(clazz -> {
System.out.println("Expecting class "+clazz.getName()+" to :");
System.out.print("\t-> be final ");
assertThat(clazz).isFinal();
System.out.println("[*]");
System.out.print("\t-> have exactly one constructor ");
Constructor<?>[] constructors = clazz.getDeclaredConstructors();
assertThat(constructors).hasSize(1);
System.out.println("[*]");
System.out.print("\t-> and that this constructor is private ");
assertThat(Modifier.isPrivate(constructors[0].getModifiers()));
System.out.println("[*]");
});
}
java类org.springframework.context.annotation.Configuration的实例源码
PrivateConstructorTest.java 文件源码
项目:EasyFXML
阅读 41
收藏 0
点赞 0
评论 0
MediaServicesAutoConfiguration.java 文件源码
项目:azure-spring-boot
阅读 29
收藏 0
点赞 0
评论 0
private MediaContract createMediaContract() throws ServiceException {
LOG.debug("createMediaContract called");
final com.microsoft.windowsazure.Configuration configuration = MediaConfiguration
.configureWithOAuthAuthentication(
MediaServicesProperties.MEDIA_SERVICE_URI,
MediaServicesProperties.OAUTH_URI,
mediaServicesProperties.getAccountName(),
mediaServicesProperties.getAccountKey(),
MediaServicesProperties.SCOPE);
if (nonNull(mediaServicesProperties.getProxyHost())
&& nonNull(mediaServicesProperties.getProxyPort())) {
configuration.getProperties().put(PROPERTY_HTTP_PROXY_HOST, mediaServicesProperties.getProxyHost());
configuration.getProperties().put(PROPERTY_HTTP_PROXY_PORT, mediaServicesProperties.getProxyPort());
configuration.getProperties().put(PROPERTY_HTTP_PROXY_SCHEME, mediaServicesProperties.getProxyScheme());
} else if (nonNull(mediaServicesProperties.getProxyHost()) && isNull(mediaServicesProperties.getProxyPort())) {
throw new ServiceException("Please Set Network Proxy port in application.properties");
} else if (nonNull(mediaServicesProperties.getProxyPort()) && isNull(mediaServicesProperties.getProxyHost())) {
throw new ServiceException("Please Set Network Proxy host in application.properties");
}
return MediaService.create(configuration);
}
TestConfiguration.java 文件源码
项目:xm-ms-config
阅读 35
收藏 0
点赞 0
评论 0
@Bean
@Primary
@SneakyThrows
public JGitRepository jGitRepository(ApplicationProperties applicationProperties, HazelcastInstance hazelcastInstance) {
return new JGitRepository(applicationProperties.getGit(), new ReentrantLock()) {
@Override
protected void initRepository(){};
@Override
protected void pull(){};
@Override
protected void commitAndPush(String commitMsg){};
@Override
public List<com.icthh.xm.ms.configuration.domain.Configuration> findAll(){
return emptyList();
}
};
}
JmsArtemisManualServerTest.java 文件源码
项目:java-spring-cloud
阅读 32
收藏 0
点赞 0
评论 0
public void start() throws Exception {
org.apache.activemq.artemis.core.config.Configuration configuration = new ConfigurationImpl();
HashSet<TransportConfiguration> transports = new HashSet<>();
transports.add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
configuration.setAcceptorConfigurations(transports);
configuration.setSecurityEnabled(false);
File targetDir = new File(System.getProperty("user.dir") + "/target");
configuration.setBrokerInstance(targetDir);
ActiveMQServer temp = new ActiveMQServerImpl(configuration);
temp.start();
server = temp;
}
TypeMapConfigurationTest.java 文件源码
项目:modelmapper-spring-boot-starter
阅读 24
收藏 0
点赞 0
评论 0
@Bean
public TypeMapConfigurer<User, UserDto> userMapping() {
return new TypeMapConfigurer<User, UserDto>() {
@Override
public org.modelmapper.config.Configuration getConfiguration() {
return new InheritingConfiguration().setSkipNullEnabled(true);
}
@Override
public void configure(TypeMap<User, UserDto> typeMap) {
typeMap.addMapping(User::getAge, UserDto::setAge);
typeMap.addMapping(User::getName, UserDto::setFirstName);
typeMap.addMapping(User::getName, UserDto::setLastName);
}
};
}
RestServiceConfiguration.java 文件源码
项目:smarti
阅读 27
收藏 0
点赞 0
评论 0
private JsonDeserializer<io.redlink.smarti.model.config.Configuration > buildConfigurationDeserializer(ObjectMapper objectMapper) {
return new JsonDeserializer<io.redlink.smarti.model.config.Configuration>() {
@Override
public io.redlink.smarti.model.config.Configuration deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
final TypeFactory tf = ctxt.getTypeFactory();
final MapLikeType smartiConfigType = tf.constructMapLikeType(Map.class,
tf.constructType(String.class),
tf.constructCollectionLikeType(List.class,
ComponentConfiguration.class));
final io.redlink.smarti.model.config.Configuration configuration = new io.redlink.smarti.model.config.Configuration();
configuration.setConfig(objectMapper.readerFor(smartiConfigType).readValue(p, smartiConfigType));
return configuration;
}
};
}
BeanConfiguration.java 文件源码
项目:steve-plugsurfing
阅读 40
收藏 0
点赞 0
评论 0
/**
* Can we re-use DSLContext as a Spring bean (singleton)? Yes, the Spring tutorial of
* Jooq also does it that way, but only if we do not change anything about the
* config after the init (which we don't do anyways) and if the ConnectionProvider
* does not store any shared state (we use DataSourceConnectionProvider of Jooq, so no problem).
*
* Some sources and discussion:
* - http://www.jooq.org/doc/3.6/manual/getting-started/tutorials/jooq-with-spring/
* - http://jooq-user.narkive.com/2fvuLodn/dslcontext-and-threads
* - https://groups.google.com/forum/#!topic/jooq-user/VK7KQcjj3Co
* - http://stackoverflow.com/questions/32848865/jooq-dslcontext-correct-autowiring-with-spring
*/
@Bean
public DSLContext dslContext() {
initDataSource();
Settings settings = new Settings()
// Normally, the records are "attached" to the Configuration that created (i.e. fetch/insert) them.
// This means that they hold an internal reference to the same database connection that was used.
// The idea behind this is to make CRUD easier for potential subsequent store/refresh/delete
// operations. We do not use or need that.
.withAttachRecords(false)
// To log or not to log the sql queries, that is the question
.withExecuteLogging(CONFIG.getDb().isSqlLogging());
// Configuration for JOOQ
org.jooq.Configuration conf = new DefaultConfiguration()
.set(SQLDialect.MYSQL)
.set(new DataSourceConnectionProvider(dataSource))
.set(settings);
return DSL.using(conf);
}
AgentDI.java 文件源码
项目:bigstreams
阅读 29
收藏 0
点赞 0
评论 0
@Bean
public GroupHeartbeatService groupHeartbeatService() throws BeansException,
UnknownHostException {
org.apache.commons.configuration.Configuration configuration = beanFactory
.getBean(org.apache.commons.configuration.Configuration.class);
final AgentConfiguration conf = beanFactory
.getBean(AgentConfiguration.class);
long initialDelay = 10000L;
long checkFrequency = configuration.getLong(
AgentProperties.HEARTBEAT_FREQUENCY.toString(), 300000L);
int port = (int) conf.getMonitoringPort();
AgentStatus status = beanFactory.getBean(AgentStatus.class);
LOG.info("USING status: " + status);
GroupHeartbeatService service = new GroupHeartbeatService(
beanFactory.getBean(GroupKeeper.class),
Group.GroupStatus.Type.AGENT, status, port, initialDelay,
checkFrequency, 10000L, beanFactory.getBean(StatusExtrasBuilder.class));
return service;
}
LogWriterDI.java 文件源码
项目:bigstreams
阅读 34
收藏 0
点赞 0
评论 0
@Bean
public LogRolloverCheck logRolloverCheck() {
org.apache.commons.configuration.Configuration conf = beanFactory
.getBean(org.apache.commons.configuration.Configuration.class);
long rolloverTime = conf.getLong(
CollectorProperties.WRITER.LOG_ROTATE_TIME.toString(),
(Long) CollectorProperties.WRITER.LOG_ROTATE_TIME
.getDefaultValue());
long inactiveTime = conf.getLong(
CollectorProperties.WRITER.LOG_ROTATE_INACTIVE_TIME.toString(),
(Long) CollectorProperties.WRITER.LOG_ROTATE_INACTIVE_TIME
.getDefaultValue());
long logSizeMb = conf
.getLong(CollectorProperties.WRITER.LOG_SIZE_MB.toString(),
(Long) CollectorProperties.WRITER.LOG_SIZE_MB
.getDefaultValue());
LOG.info("Using LogRollover: inactiveTime: " + inactiveTime
+ " rolloverTime: " + rolloverTime + " logSizeMb: " + logSizeMb);
return new SimpleLogRolloverCheck(rolloverTime, logSizeMb, inactiveTime);
}
LogWriterDI.java 文件源码
项目:bigstreams
阅读 33
收藏 0
点赞 0
评论 0
@Bean
public CompressionPoolFactory compressionPoolFactory() {
org.apache.commons.configuration.Configuration configuration = beanFactory
.getBean(org.apache.commons.configuration.Configuration.class);
int decompressorPoolSize = configuration
.getInt(CollectorProperties.WRITER.COLLECTOR_DECOMPRESSOR_POOLSIZE
.toString(),
(Integer) CollectorProperties.WRITER.COLLECTOR_DECOMPRESSOR_POOLSIZE
.getDefaultValue());
int compressorPoolSize = configuration
.getInt(CollectorProperties.WRITER.COLLECTOR_COMPRESSOR_POOLSIZE
.toString(),
(Integer) CollectorProperties.WRITER.COLLECTOR_COMPRESSOR_POOLSIZE
.getDefaultValue());
return new CompressionPoolFactoryImpl(decompressorPoolSize,
compressorPoolSize, beanFactory.getBean(CollectorStatus.class));
}
CollectorDI.java 文件源码
项目:bigstreams
阅读 36
收藏 0
点赞 0
评论 0
@Bean
public StatusExtrasBuilder getStatusExtrasBuilder() {
org.apache.commons.configuration.Configuration configuration = beanFactory
.getBean(org.apache.commons.configuration.Configuration.class);
String baseDir = configuration.getString(
CollectorProperties.WRITER.BASE_DIR.toString(),
CollectorProperties.WRITER.BASE_DIR.getDefaultValue()
.toString());
return new StatusExtrasBuilder(
beanFactory.getBean(CollectorStatus.class), baseDir,
(CounterMetric) beanFactory
.getBean("connectionsReceivedMetric"),
(CounterMetric) beanFactory
.getBean("connectionsProcessedMetric"),
(CounterMetric) beanFactory.getBean("kilobytesWrttenMetric"),
(CounterMetric) beanFactory.getBean("errorsMetric"));
}
CollectorDI.java 文件源码
项目:bigstreams
阅读 53
收藏 0
点赞 0
评论 0
@Bean
public OrphanedFilesCheck OrphanedFilesCheck() {
org.apache.commons.configuration.Configuration configuration = beanFactory
.getBean(org.apache.commons.configuration.Configuration.class);
String baseDir = configuration.getString(
CollectorProperties.WRITER.BASE_DIR.toString(),
CollectorProperties.WRITER.BASE_DIR.getDefaultValue()
.toString());
long lowerMod = configuration.getLong(
CollectorProperties.WRITER.ORPHANED_FILE_LOWER_MODE.toString(),
(Long) CollectorProperties.WRITER.ORPHANED_FILE_LOWER_MODE
.getDefaultValue());
File file = new File(baseDir);
return new OrphanedFilesCheckImpl(file,
beanFactory.getBean(LogRolloverCheck.class),
beanFactory.getBean(LogFileNameExtractor.class),
beanFactory.getBean(LogRollover.class), beanFactory.getBean(
FileOutputStreamPoolFactory.class).getPoolForKey(
"orphanedFiles"), lowerMod);
}
CollectorDI.java 文件源码
项目:bigstreams
阅读 32
收藏 0
点赞 0
评论 0
@Bean
public LogFileNameExtractor logFileNameExtractor() throws Exception {
org.apache.commons.configuration.Configuration configuration = beanFactory
.getBean(org.apache.commons.configuration.Configuration.class);
String cls = configuration
.getString(CollectorProperties.WRITER.LOG_NAME_EXTRACTOR
.toString());
LogFileNameExtractor nameExtractor = null;
if (cls == null) {
String keys = configuration.getString(
CollectorProperties.WRITER.LOG_NAME_KEYS.toString(),
CollectorProperties.WRITER.LOG_NAME_KEYS.getDefaultValue()
.toString());
String[] splits = keys.split(",");
nameExtractor = new DateHourFileNameExtractor(splits);
} else {
nameExtractor = (LogFileNameExtractor) Thread.currentThread()
.getContextClassLoader().loadClass(cls).newInstance();
}
return nameExtractor;
}
CollectorDI.java 文件源码
项目:bigstreams
阅读 43
收藏 0
点赞 0
评论 0
/**
* Configures a restlet ping component
*
* @return
*/
@Bean
public Component restletPingComponent() {
org.apache.commons.configuration.Configuration configuration = beanFactory
.getBean(org.apache.commons.configuration.Configuration.class);
Component component = new Component();
component.getServers().add(
org.restlet.data.Protocol.HTTP,
configuration.getInt(CollectorProperties.WRITER.PING_PORT
.toString(),
(Integer) CollectorProperties.WRITER.PING_PORT
.getDefaultValue()));
component.getDefaultHost().attach(restletPingApplication());
return component;
}
CoordinationDI.java 文件源码
项目:bigstreams
阅读 33
收藏 0
点赞 0
评论 0
@Bean
public LockTimeoutCheckAppService lockTimeoutCheckAppService() {
org.apache.commons.configuration.Configuration configuration = beanFactory
.getBean(org.apache.commons.configuration.Configuration.class);
long lockTimeoutPeriod = configuration
.getLong(
CoordinationProperties.PROP.COORDINATION_LOCK_TIMEOUTCHECK_PERIOD
.toString(),
(Long) CoordinationProperties.PROP.COORDINATION_LOCK_TIMEOUTCHECK_PERIOD
.getDefaultValue());
long lockTimeout = configuration.getLong(
CoordinationProperties.PROP.COORDINATION_LOCK_TIMEOUT
.toString(),
(Long) CoordinationProperties.PROP.COORDINATION_LOCK_TIMEOUT
.getDefaultValue());
return new LockTimeoutCheckAppService(lockTimeoutPeriod, lockTimeout,
beanFactory.getBean(LockMemory.class));
}
CoordinationDI.java 文件源码
项目:bigstreams
阅读 26
收藏 0
点赞 0
评论 0
@Bean
public CoordinationServer coordinationServer() {
org.apache.commons.configuration.Configuration configuration = beanFactory
.getBean(org.apache.commons.configuration.Configuration.class);
int lockPort = configuration.getInt(
CoordinationProperties.PROP.COORDINATION_LOCK_PORT.toString(),
(Integer) CoordinationProperties.PROP.COORDINATION_LOCK_PORT
.getDefaultValue());
int releaseLockPort = configuration
.getInt(CoordinationProperties.PROP.COORDINATION_UNLOCK_PORT
.toString(),
(Integer) CoordinationProperties.PROP.COORDINATION_UNLOCK_PORT
.getDefaultValue());
return new CoordinationServerImpl(lockPort, releaseLockPort,
beanFactory.getBean(CoordinationLockHandler.class), beanFactory.getBean(
CoordinationUnLockHandler.class), beanFactory.getBean(
MetricChannel.class));
}
CoordinationDI.java 文件源码
项目:bigstreams
阅读 32
收藏 0
点赞 0
评论 0
@Bean
@Lazy
public CoordinationLockHandler coordinationLockHandler() {
org.apache.commons.configuration.Configuration configuration = beanFactory
.getBean(org.apache.commons.configuration.Configuration.class);
int port = configuration.getInt(
CoordinationProperties.PROP.LOCK_HOLDER_PING_PORT.toString(),
(Integer) CoordinationProperties.PROP.LOCK_HOLDER_PING_PORT
.getDefaultValue());
long lockTimeout = configuration.getLong(
CoordinationProperties.PROP.COORDINATION_LOCK_TIMEOUT
.toString(),
(Long) CoordinationProperties.PROP.COORDINATION_LOCK_TIMEOUT
.getDefaultValue());
return new CoordinationLockHandler(
beanFactory.getBean(CoordinationStatus.class),
beanFactory.getBean(LockMemory.class),
beanFactory.getBean(HazelcastFileTrackerStorage.class), port,
lockTimeout,
beanFactory.getBean(FileTrackerHistoryMemory.class));
}
CoordinationDI.java 文件源码
项目:bigstreams
阅读 29
收藏 0
点赞 0
评论 0
@Bean
public StatusCleanoutService statusCleanoutService() throws Exception {
// default once day
org.apache.commons.configuration.Configuration configuration = beanFactory
.getBean(org.apache.commons.configuration.Configuration.class);
FileStatusCleanoutManager fileStatusCleanoutManager = beanFactory
.getBean(FileStatusCleanoutManager.class);
int statusCleanoutInterval = configuration
.getInt(CoordinationProperties.PROP.STATUS_CLEANOUT_INTERVAL
.toString(),
(Integer) CoordinationProperties.PROP.STATUS_CLEANOUT_INTERVAL
.getDefaultValue());
StatusCleanoutService service = new StatusCleanoutService(
fileStatusCleanoutManager, 10, statusCleanoutInterval);
return service;
}
JooqAutoConfiguration.java 文件源码
项目:https-github.com-g0t4-jenkins2-course-spring-boot
阅读 40
收藏 0
点赞 0
评论 0
@Bean
@ConditionalOnMissingBean(org.jooq.Configuration.class)
public DefaultConfiguration jooqConfiguration() {
DefaultConfiguration configuration = new DefaultConfiguration();
if (this.properties.getSqlDialect() != null) {
configuration.set(this.properties.getSqlDialect());
}
configuration.set(this.connectionProvider);
if (this.transactionProvider != null) {
configuration.set(this.transactionProvider);
}
if (this.recordMapperProvider != null) {
configuration.set(this.recordMapperProvider);
}
if (this.settings != null) {
configuration.set(this.settings);
}
configuration.set(this.recordListenerProviders);
configuration.set(this.executeListenerProviders);
configuration.set(this.visitListenerProviders);
return configuration;
}
HornetQAutoConfigurationTests.java 文件源码
项目:https-github.com-g0t4-jenkins2-course-spring-boot
阅读 36
收藏 0
点赞 0
评论 0
@Test
public void embeddedConnectionFactory() {
load(EmptyConfiguration.class, "spring.hornetq.mode:embedded");
HornetQProperties properties = this.context.getBean(HornetQProperties.class);
assertThat(properties.getMode()).isEqualTo(HornetQMode.EMBEDDED);
assertThat(this.context.getBeansOfType(EmbeddedJMS.class)).hasSize(1);
org.hornetq.core.config.Configuration configuration = this.context
.getBean(org.hornetq.core.config.Configuration.class);
assertThat(configuration.isPersistenceEnabled()).isFalse();
assertThat(configuration.isSecurityEnabled()).isFalse();
HornetQConnectionFactory connectionFactory = this.context
.getBean(HornetQConnectionFactory.class);
assertInVmConnectionFactory(connectionFactory);
}
JooqAutoConfiguration.java 文件源码
项目:spring-boot-concourse
阅读 38
收藏 0
点赞 0
评论 0
@Bean
@ConditionalOnMissingBean(org.jooq.Configuration.class)
public DefaultConfiguration jooqConfiguration() {
DefaultConfiguration configuration = new DefaultConfiguration();
if (this.properties.getSqlDialect() != null) {
configuration.set(this.properties.getSqlDialect());
}
configuration.set(this.connectionProvider);
if (this.transactionProvider != null) {
configuration.set(this.transactionProvider);
}
if (this.recordMapperProvider != null) {
configuration.set(this.recordMapperProvider);
}
if (this.settings != null) {
configuration.set(this.settings);
}
configuration.set(this.recordListenerProviders);
configuration.set(this.executeListenerProviders);
configuration.set(this.visitListenerProviders);
return configuration;
}
AbstractConfigurationClassTests.java 文件源码
项目:https-github.com-g0t4-jenkins2-course-spring-boot
阅读 36
收藏 0
点赞 0
评论 0
private Set<AnnotationMetadata> findConfigurationClasses() throws IOException {
Set<AnnotationMetadata> configurationClasses = new HashSet<AnnotationMetadata>();
Resource[] resources = this.resolver.getResources("classpath*:"
+ getClass().getPackage().getName().replace(".", "/") + "/**/*.class");
for (Resource resource : resources) {
if (!isTestClass(resource)) {
MetadataReader metadataReader = new SimpleMetadataReaderFactory()
.getMetadataReader(resource);
AnnotationMetadata annotationMetadata = metadataReader
.getAnnotationMetadata();
if (annotationMetadata.getAnnotationTypes()
.contains(Configuration.class.getName())) {
configurationClasses.add(annotationMetadata);
}
}
}
return configurationClasses;
}
AbstractConfigurationClassTests.java 文件源码
项目:spring-boot-concourse
阅读 40
收藏 0
点赞 0
评论 0
private Set<AnnotationMetadata> findConfigurationClasses() throws IOException {
Set<AnnotationMetadata> configurationClasses = new HashSet<AnnotationMetadata>();
Resource[] resources = this.resolver.getResources("classpath*:"
+ getClass().getPackage().getName().replace(".", "/") + "/**/*.class");
for (Resource resource : resources) {
if (!isTestClass(resource)) {
MetadataReader metadataReader = new SimpleMetadataReaderFactory()
.getMetadataReader(resource);
AnnotationMetadata annotationMetadata = metadataReader
.getAnnotationMetadata();
if (annotationMetadata.getAnnotationTypes()
.contains(Configuration.class.getName())) {
configurationClasses.add(annotationMetadata);
}
}
}
return configurationClasses;
}
ApplicationContext.java 文件源码
项目:springboot-jsp-generator
阅读 33
收藏 0
点赞 0
评论 0
@Bean(name="freeMarkerCfg")
public freemarker.template.Configuration freemarkerConfig() throws IOException {
freemarker.template.Configuration cfg = new freemarker.template.Configuration(freemarker.template.Configuration.VERSION_2_3_25);
cfg.setDirectoryForTemplateLoading(new File(templateFolder));
// cfg.setClassForTemplateLoading(this.getClass(), "templates");
cfg.setDefaultEncoding("UTF-8");
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
cfg.setLogTemplateExceptions(false);
return cfg;
}
HttpConfiguration.java 文件源码
项目:emergentmud
阅读 33
收藏 0
点赞 0
评论 0
@Bean
public FreeMarkerConfigurer configureFreemarker() {
FreeMarkerConfigurer freeMarkerConfigurer = new FreeMarkerConfigurer();
Properties settings = new Properties();
settings.setProperty(freemarker.template.Configuration.TEMPLATE_EXCEPTION_HANDLER_KEY, "rethrow");
freeMarkerConfigurer.setFreemarkerSettings(settings);
freeMarkerConfigurer.setTemplateLoaderPath(FreeMarkerProperties.DEFAULT_TEMPLATE_LOADER_PATH);
return freeMarkerConfigurer;
}
AutomaticJobRegistrarConfigurationSupport.java 文件源码
项目:spring-batch-support
阅读 31
收藏 0
点赞 0
评论 0
protected boolean isCandidate(MetadataReader metadataReader) throws ClassNotFoundException {
try {
Class<?> c = forName(metadataReader.getClassMetadata().getClassName());
if (c.getAnnotation(Configuration.class) != null) {
return true;
}
} catch (Throwable e) {
LOGGER.debug("error {}", e);
}
return false;
}
SpringDependencyAnalyzer.java 文件源码
项目:spring-depend
阅读 40
收藏 0
点赞 0
评论 0
private void validateIsConfigurationClass(Class<?> configurationClass) {
boolean isConfigClass = false;
for(Annotation annotation : configurationClass.getAnnotations()) {
Class<? extends Annotation> type = annotation.annotationType();
if(Configuration.class.equals(type)) {
isConfigClass = true;
}
}
if(!isConfigClass) {
throw new IllegalArgumentException("not a spring configuration class");
}
}
SnsConfiguration.java 文件源码
项目:circus-train
阅读 32
收藏 0
点赞 0
评论 0
private static String getKey(org.apache.hadoop.conf.Configuration conf, String keyType) {
checkNotNull(conf, "conf cannot be null");
checkNotNull(keyType, "KeyType cannot be null");
try {
char[] key = conf.getPassword(keyType);
if (key == null) {
throw new IllegalStateException(format("Unable to get value of '%s'", keyType));
}
return new String(key);
} catch (IOException e) {
throw new IllegalStateException(format("Error getting key for '%s' from credential provider", keyType), e);
}
}
QuartzAppContext.java 文件源码
项目:cf-mta-deploy-service
阅读 25
收藏 0
点赞 0
评论 0
@Bean(name = "cleanUpCronTriggerFactoryBean")
public CronTriggerFactoryBean cronTriggerFactoryBean() {
com.sap.cloud.lm.sl.cf.core.util.Configuration configuration = com.sap.cloud.lm.sl.cf.core.util.Configuration.getInstance();
CronTriggerFactoryBean factory = new CronTriggerFactoryBean();
factory.setJobDetail(jobDetailFactoryBean().getObject());
factory.setCronExpression(configuration.getCronExpressionForOldData());
factory.setGroup(TRIGGER_GROUP);
factory.setName(CLEAN_UP_TRIGGER_NAME);
return factory;
}
AzureServiceBusAutoConfiguration.java 文件源码
项目:azure-service-broker-client
阅读 33
收藏 0
点赞 0
评论 0
private ServiceBusContract createServiceBusContract()
{
LOG.debug("createServiceBusContract start...");
ServiceBusContract service = null;
if (properties.getNamespaceName() != null)
{
com.microsoft.windowsazure.Configuration config = new com.microsoft.windowsazure.Configuration();
String connectionString = properties.buildServiceBusConnectString();
ServiceBusConfiguration.configureWithConnectionString(null, config, connectionString);
service = ServiceBusService.create(config);
}
return service;
}