本文整理了Java中org.springframework.context.annotation.Configuration
类的一些代码示例,展示了Configuration
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration
类的具体详情如下:
包路径:org.springframework.context.annotation.Configuration
类名称:Configuration
暂无
代码示例来源:origin: spring-projects/spring-framework
@Configuration
@Import(NameConfig.class)
static class AutowiredConfig {
@Autowired String autowiredName;
@Bean TestBean testBean() {
TestBean testBean = new TestBean();
testBean.name = autowiredName;
return testBean;
}
}
代码示例来源:origin: spring-cloud-incubator/spring-cloud-alibaba
@Configuration
@EnableConfigurationProperties
@ConditionalOnClass(name = "com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest")
@ConditionalOnProperty(value = "spring.cloud.alibaba.deshao.enable.sms", matchIfMissing = true)
public class SmsContextAutoConfiguration {
@Bean
public SmsConfigProperties smsConfigProperties(
AliCloudProperties aliCloudProperties) {
return new SmsConfigProperties(aliCloudProperties);
}
@Bean
public SmsConfigRegistration smsConfigRegistration(Environment environment,
SmsConfigProperties smsConfigProperties) {
return new SmsConfigRegistration(environment, smsConfigProperties);
}
}
代码示例来源:origin: hs-web/hsweb-framework
@Configuration
@AutoConfigureAfter(FlowableAutoConfiguration.CustomEntityManagerAutoConfiguration.class)
@MapperScan(value = "org.hswebframework.web.workflow.dao", markerInterface = Dao.class
, sqlSessionFactoryRef = "sqlSessionFactory")
public class FlowableAutoConfiguration {
@Autowired(required = false)
private List<SessionFactory> sessionFactories;
@Autowired(required = false)
private List<ActivitiEventListener> activitiEventListeners;
代码示例来源:origin: spring-projects/spring-framework
@Configuration
public static class AStrich {
@Autowired
B b;
@Bean
public Z z() {
return new Z();
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
/**
* @author Robert HG (254963746@qq.com) on 4/9/16.
*/
@Configuration
@ConditionalOnBean(annotation = EnableJobTracker.class)
@EnableConfigurationProperties(JobTrackerProperties.class)
public class JobTrackerAutoConfiguration extends AbstractAutoConfiguration {
@Autowired(required = false)
private JobTrackerProperties properties;
private JobTracker jobTracker;
@Override
protected void initJobNode() {
jobTracker = JobTrackerBuilder.buildByProperties(properties);
}
@Override
protected NodeType nodeType() {
return NodeType.JOB_TRACKER;
}
@Override
protected AbstractJobNode getJobNode() {
return jobTracker;
}
}
代码示例来源:origin: spring-projects/spring-framework
@Configuration
@ComponentScan(basePackageClasses=SpringConfiguratorTests.class)
static class Config {
@Bean
public EchoEndpoint javaConfigEndpoint() {
return new EchoEndpoint(echoService());
}
@Bean
public EchoService echoService() {
return new EchoService();
}
}
代码示例来源:origin: spring-cloud/spring-cloud-kubernetes
@Configuration
@Import(KubernetesAutoConfiguration.class)
@EnableConfigurationProperties({ ConfigMapConfigProperties.class,
SecretsConfigProperties.class })
protected static class KubernetesPropertySourceConfiguration {
@Autowired
private KubernetesClient client;
@Bean
@ConditionalOnProperty(name = "spring.cloud.kubernetes.config.enabled", matchIfMissing = true)
public ConfigMapPropertySourceLocator configMapPropertySourceLocator(
ConfigMapConfigProperties properties) {
return new ConfigMapPropertySourceLocator(client, properties);
}
@Bean
@ConditionalOnProperty(name = "spring.cloud.kubernetes.secrets.enabled", matchIfMissing = true)
public SecretsPropertySourceLocator secretsPropertySourceLocator(
SecretsConfigProperties properties) {
return new SecretsPropertySourceLocator(client, properties);
}
}
}
代码示例来源:origin: hs-web/hsweb-framework
@Configuration
@EnableConfigurationProperties(SchedulerProperties.class)
@ConditionalOnMissingBean({Scheduler.class, SchedulerFactoryBean.class})
@ComponentScan({"org.hswebframework.web.service.schedule.simple"
, "org.hswebframework.web.controller.schedule"})
@Slf4j
public class ScheduleAutoConfiguration {
@Autowired
private SchedulerProperties schedulerProperties;
@Autowired
private ApplicationContext applicationContext;
@Autowired
private DataSource dataSource;
代码示例来源:origin: redisson/redisson
/**
*
* @author Craig Andrews
*
* {@link EnableAutoConfiguration Auto-configuration} for {@link RedissonCacheStatisticsProvider}
*
*/
@Configuration
@AutoConfigureAfter(CacheAutoConfiguration.class)
@ConditionalOnBean(CacheManager.class)
@ConditionalOnClass(CacheStatisticsProvider.class)
public class RedissonCacheStatisticsAutoConfiguration {
@Bean
public RedissonCacheStatisticsProvider redissonCacheStatisticsProvider(){
return new RedissonCacheStatisticsProvider();
}
}
代码示例来源:origin: spring-projects/spring-framework
@Configuration
@ComponentScan(
basePackages = "org.springframework.context.annotation.configuration.spr9031.scanpackage",
includeFilters = { @Filter(MarkerAnnotation.class) })
static class LowLevelConfig {
// fails to wire when LowLevelConfig is processed with ASM because nested @Filter
// annotation is not parsed
@Autowired Spr9031Component scanned;
}
代码示例来源:origin: spring-projects/spring-framework
@Configuration
@Import(B.class)
static class A {
@Bean
TestBean b1() {
return new TestBean();
}
}
代码示例来源:origin: blox/blox
@Configuration
@Import(MapperConfiguration.class)
@ComponentScan(
basePackages = {"com.amazonaws.blox.frontend.operations", "com.amazonaws.blox.frontend.exception"}
public class IntegrationTestConfig {
@Autowired private ConfigurableWebApplicationContext applicationContext;
代码示例来源:origin: hs-web/hsweb-framework
@Configuration
@ConditionalOnProperty(prefix = "hsweb.authorize", name = "basic-authorization", havingValue = "true")
@ConditionalOnClass(UserTokenForTypeParser.class)
public static class BasicAuthorizationConfiguration {
@Bean
public BasicAuthorizationTokenParser basicAuthorizationTokenParser(AuthenticationManager authenticationManager,
UserTokenManager tokenManager) {
return new BasicAuthorizationTokenParser(authenticationManager, tokenManager);
}
}
}
代码示例来源:origin: spring-cloud-incubator/spring-cloud-alibaba
/**
* @author xiaolongzuo
*/
@Configuration
@EnableConfigurationProperties({ AliCloudProperties.class, InetUtilsProperties.class })
public class AliCloudContextAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public InetUtils inetUtils(InetUtilsProperties inetUtilsProperties) {
return new InetUtils(inetUtilsProperties);
}
}
代码示例来源:origin: hs-web/hsweb-framework
@Configuration
@ConditionalOnClass(org.hswebframework.web.datasource.jta.JtaDynamicDataSourceService.class)
public static class InDBJtaDynamicDataSourceServiceAutoConfiguration {
@Bean
public DynamicDataSourceService inDBJtaDynamicDataSourceService(InDBDataSourceRepository repository,
DataSource dataSource) {
return new InDBJtaDynamicDataSourceService(repository, new DynamicDataSourceProxy("dataSource", dataSource));
}
}
代码示例来源:origin: spring-cloud-incubator/spring-cloud-alibaba
/**
* @author xiaolongzuo
*/
@Configuration
@ConditionalOnClass(name = "org.springframework.cloud.alicloud.ans.AnsAutoConfiguration")
@EnableConfigurationProperties(AnsProperties.class)
@ImportAutoConfiguration(EdasContextAutoConfiguration.class)
public class AnsContextAutoConfiguration {
}
代码示例来源:origin: hs-web/hsweb-framework
@Configuration
@ComponentScan("org.hswebframework.web.dao.mybatis")
@MapperScan(value = "org.hswebframework.web.dao"
, markerInterface = Dao.class
, sqlSessionFactoryRef = "sqlSessionFactory")
@AutoConfigureAfter(MyBatisAutoConfiguration.class)
@EnableConfigurationProperties(MybatisProperties.class)
public class MybatisDaoAutoConfiguration {
@Bean
代码示例来源:origin: AxonFramework/AxonFramework
@ConditionalOnClass(SpringAxonAutoConfigurer.class)
@AutoConfigureAfter({
AxonAutoConfiguration.class,
JpaAutoConfiguration.class,
JpaEventStoreAutoConfiguration.class,
NoOpTransactionAutoConfiguration.class,
TransactionAutoConfiguration.class})
@Import(SpringAxonAutoConfigurer.ImportSelector.class)
@AnnotationDriven
@Configuration
public class InfraConfiguration {
}
代码示例来源:origin: spring-cloud-incubator/spring-cloud-alibaba
/**
* {@link org.springframework.boot.autoconfigure.EnableAutoConfiguration
* Auto-configuration} that sets up Ribbon for Nacos.
*/
@Configuration
@EnableConfigurationProperties
@ConditionalOnBean(SpringClientFactory.class)
@ConditionalOnRibbonNacos
@AutoConfigureAfter(RibbonAutoConfiguration.class)
@RibbonClients(defaultConfiguration = NacosRibbonClientConfiguration.class)
public class RibbonNacosAutoConfiguration {
}
代码示例来源:origin: AxonFramework/AxonFramework
@Configuration
@AutoConfigureBefore(AxonAutoConfiguration.class)
@AutoConfigureAfter(name = "org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration")
@ConditionalOnClass(name = "com.fasterxml.jackson.databind.ObjectMapper")
@EnableConfigurationProperties(value = SerializerProperties.class)
public class ObjectMapperAutoConfiguration {
@Bean("defaultAxonObjectMapper")
@ConditionalOnMissingBean
@ConditionalOnExpression("'${axon.serializer.general}' == 'jackson' || '${axon.serializer.events}' == 'jackson' || '${axon.serializer.messages}' == 'jackson'")
public ObjectMapper defaultAxonObjectMapper() {
return new ObjectMapper().findAndRegisterModules();
}
}
内容来源于网络,如有侵权,请联系作者删除!