本文整理汇总了Java中org.springframework.context.annotation.ScannedGenericBeanDefinition类的典型用法代码示例。如果您正苦于以下问题:Java ScannedGenericBeanDefinition类的具体用法?Java ScannedGenericBeanDefinition怎么用?Java ScannedGenericBeanDefinition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ScannedGenericBeanDefinition类属于org.springframework.context.annotation包,在下文中一共展示了ScannedGenericBeanDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: defaultServletConfiguration
import org.springframework.context.annotation.ScannedGenericBeanDefinition; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void defaultServletConfiguration() throws IOException {
ScannedGenericBeanDefinition scanned = new ScannedGenericBeanDefinition(
new SimpleMetadataReaderFactory()
.getMetadataReader(DefaultConfigurationServlet.class.getName()));
this.handler.handle(scanned, this.registry);
BeanDefinition servletRegistrationBean = this.registry
.getBeanDefinition(DefaultConfigurationServlet.class.getName());
MutablePropertyValues propertyValues = servletRegistrationBean
.getPropertyValues();
assertThat(propertyValues.get("asyncSupported")).isEqualTo(false);
assertThat(((Map<String, String>) propertyValues.get("initParameters")))
.isEmpty();
assertThat((Integer) propertyValues.get("loadOnStartup")).isEqualTo(-1);
assertThat(propertyValues.get("name"))
.isEqualTo(DefaultConfigurationServlet.class.getName());
assertThat((String[]) propertyValues.get("urlMappings")).isEmpty();
assertThat(propertyValues.get("servlet")).isEqualTo(scanned);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:21,代码来源:WebServletHandlerTests.java
示例2: defaultFilterConfiguration
import org.springframework.context.annotation.ScannedGenericBeanDefinition; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void defaultFilterConfiguration() throws IOException {
ScannedGenericBeanDefinition scanned = new ScannedGenericBeanDefinition(
new SimpleMetadataReaderFactory()
.getMetadataReader(DefaultConfigurationFilter.class.getName()));
this.handler.handle(scanned, this.registry);
BeanDefinition filterRegistrationBean = this.registry
.getBeanDefinition(DefaultConfigurationFilter.class.getName());
MutablePropertyValues propertyValues = filterRegistrationBean.getPropertyValues();
assertThat(propertyValues.get("asyncSupported")).isEqualTo(false);
assertThat((EnumSet<DispatcherType>) propertyValues.get("dispatcherTypes"))
.containsExactly(DispatcherType.REQUEST);
assertThat(((Map<String, String>) propertyValues.get("initParameters")))
.isEmpty();
assertThat((String[]) propertyValues.get("servletNames")).isEmpty();
assertThat((String[]) propertyValues.get("urlPatterns")).isEmpty();
assertThat(propertyValues.get("name"))
.isEqualTo(DefaultConfigurationFilter.class.getName());
assertThat(propertyValues.get("filter")).isEqualTo(scanned);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:22,代码来源:WebFilterHandlerTests.java
示例3: defaultServletConfiguration
import org.springframework.context.annotation.ScannedGenericBeanDefinition; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void defaultServletConfiguration() throws IOException {
ScannedGenericBeanDefinition scanned = new ScannedGenericBeanDefinition(
new SimpleMetadataReaderFactory()
.getMetadataReader(DefaultConfigurationServlet.class.getName()));
this.handler.handle(scanned, this.registry);
BeanDefinition servletRegistrationBean = this.registry
.getBeanDefinition(DefaultConfigurationServlet.class.getName());
MutablePropertyValues propertyValues = servletRegistrationBean
.getPropertyValues();
assertThat(propertyValues.get("asyncSupported"), is((Object) false));
assertThat(((Map<String, String>) propertyValues.get("initParameters")).size(),
is(0));
assertThat((Integer) propertyValues.get("loadOnStartup"), is(-1));
assertThat(propertyValues.get("name"),
is((Object) DefaultConfigurationServlet.class.getName()));
assertThat((String[]) propertyValues.get("urlMappings"), is(arrayWithSize(0)));
assertThat(propertyValues.get("servlet"), is(equalTo((Object) scanned)));
}
示例4: defaultFilterConfiguration
import org.springframework.context.annotation.ScannedGenericBeanDefinition; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void defaultFilterConfiguration() throws IOException {
ScannedGenericBeanDefinition scanned = new ScannedGenericBeanDefinition(
new SimpleMetadataReaderFactory()
.getMetadataReader(DefaultConfigurationFilter.class.getName()));
this.handler.handle(scanned, this.registry);
BeanDefinition filterRegistrationBean = this.registry
.getBeanDefinition(DefaultConfigurationFilter.class.getName());
MutablePropertyValues propertyValues = filterRegistrationBean.getPropertyValues();
assertThat(propertyValues.get("asyncSupported"), is((Object) false));
assertThat((EnumSet<DispatcherType>) propertyValues.get("dispatcherTypes"),
is(EnumSet.of(DispatcherType.REQUEST)));
assertThat(((Map<String, String>) propertyValues.get("initParameters")).size(),
is(0));
assertThat((String[]) propertyValues.get("servletNames"), is(arrayWithSize(0)));
assertThat((String[]) propertyValues.get("urlPatterns"), is(arrayWithSize(0)));
assertThat(propertyValues.get("name"),
is((Object) DefaultConfigurationFilter.class.getName()));
assertThat(propertyValues.get("filter"), is(equalTo((Object) scanned)));
}
示例5: doScan
import org.springframework.context.annotation.ScannedGenericBeanDefinition; //导入依赖的package包/类
@Override
protected Set<BeanDefinitionHolder> doScan(String... basePackages) {
Set<BeanDefinitionHolder> beanDefinitionHolders = super.doScan(basePackages);
Assert.notEmpty(basePackages, "At least one base package must be specified");
Set<BeanDefinition> candidates = findCandidateComponents(basePackage);
if (candidates.isEmpty()) {
logger.warn("No MyBatis mapper was found in 'ffff' package. Please check your configuration.");
} else {
for (BeanDefinition beanDefinition : candidates) {
if(beanDefinition instanceof ScannedGenericBeanDefinition){
ScannedGenericBeanDefinition sgBeanDefinition = (ScannedGenericBeanDefinition)beanDefinition;
Map<String, Object> metaMap = sgBeanDefinition.getMetadata().getAnnotationAttributes(annotationMappingClass.getName());
String parent = RestDataUtils.typeAnnotationAttributesResolver(metaMap);
String beanName = this.beanNameGenerator.generateBeanName(beanDefinition, super.getRegistry());
registerRestInfo(beanName, beanDefinition, sgBeanDefinition, parent, RestAnotationType.MAPPING);
registerRestInfo(beanName, beanDefinition, sgBeanDefinition, parent, RestAnotationType.VALIDATOR);
}
}
}
RestHandlerMethodMapping.registerGenericRestful(applicationContext.getBean(GENERIC_RESTFUL_SERVICE));
return beanDefinitionHolders;
}
示例6: handle
import org.springframework.context.annotation.ScannedGenericBeanDefinition; //导入依赖的package包/类
void handle(ScannedGenericBeanDefinition beanDefinition, BeanDefinitionRegistry registry) {
Map<String, Object> attributes = beanDefinition.getMetadata()
.getAnnotationAttributes(this.annotationType.getName());
if (attributes != null) {
doHandle(attributes, beanDefinition, registry);
}
}
示例7: scanPackage
import org.springframework.context.annotation.ScannedGenericBeanDefinition; //导入依赖的package包/类
private void scanPackage(ClassPathScanningCandidateComponentProvider componentProvider, String packageToScan) {
for (BeanDefinition candidate : componentProvider.findCandidateComponents(packageToScan)) {
if (candidate instanceof ScannedGenericBeanDefinition) {
for (ServletComponentHandler handler : HANDLERS) {
handler.handle(((ScannedGenericBeanDefinition) candidate),
(BeanDefinitionRegistry) this.applicationContext);
}
}
}
}
开发者ID:PebbleTemplates,项目名称:pebble-spring-boot-starter,代码行数:11,代码来源:ServletComponenRegisteringPostProcessor.java
示例8: scanPackage
import org.springframework.context.annotation.ScannedGenericBeanDefinition; //导入依赖的package包/类
private void scanPackage(
ClassPathScanningCandidateComponentProvider componentProvider,
String packageToScan) {
for (BeanDefinition candidate : componentProvider
.findCandidateComponents(packageToScan)) {
if (candidate instanceof ScannedGenericBeanDefinition) {
for (ServletComponentHandler handler : HANDLERS) {
handler.handle(((ScannedGenericBeanDefinition) candidate),
(BeanDefinitionRegistry) this.applicationContext);
}
}
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:ServletComponentRegisteringPostProcessor.java
示例9: handle
import org.springframework.context.annotation.ScannedGenericBeanDefinition; //导入依赖的package包/类
void handle(ScannedGenericBeanDefinition beanDefinition,
BeanDefinitionRegistry registry) {
Map<String, Object> attributes = beanDefinition.getMetadata()
.getAnnotationAttributes(this.annotationType.getName());
if (attributes != null) {
doHandle(attributes, beanDefinition, registry);
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:ServletComponentHandler.java
示例10: listener
import org.springframework.context.annotation.ScannedGenericBeanDefinition; //导入依赖的package包/类
@Test
public void listener() throws IOException {
ScannedGenericBeanDefinition scanned = new ScannedGenericBeanDefinition(
new SimpleMetadataReaderFactory()
.getMetadataReader(TestListener.class.getName()));
this.handler.handle(scanned, this.registry);
this.registry.getBeanDefinition(TestListener.class.getName());
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:WebListenerHandlerTests.java
示例11: servletWithCustomName
import org.springframework.context.annotation.ScannedGenericBeanDefinition; //导入依赖的package包/类
@Test
public void servletWithCustomName() throws IOException {
ScannedGenericBeanDefinition scanned = new ScannedGenericBeanDefinition(
new SimpleMetadataReaderFactory()
.getMetadataReader(CustomNameServlet.class.getName()));
this.handler.handle(scanned, this.registry);
BeanDefinition servletRegistrationBean = this.registry
.getBeanDefinition("custom");
MutablePropertyValues propertyValues = servletRegistrationBean
.getPropertyValues();
assertThat(propertyValues.get("name")).isEqualTo("custom");
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:13,代码来源:WebServletHandlerTests.java
示例12: getBeanDefinition
import org.springframework.context.annotation.ScannedGenericBeanDefinition; //导入依赖的package包/类
BeanDefinition getBeanDefinition(Class<?> filterClass) throws IOException {
ScannedGenericBeanDefinition scanned = new ScannedGenericBeanDefinition(
new SimpleMetadataReaderFactory()
.getMetadataReader(filterClass.getName()));
this.handler.handle(scanned, this.registry);
return this.registry.getBeanDefinition(filterClass.getName());
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:WebServletHandlerTests.java
示例13: filterWithCustomName
import org.springframework.context.annotation.ScannedGenericBeanDefinition; //导入依赖的package包/类
@Test
public void filterWithCustomName() throws IOException {
ScannedGenericBeanDefinition scanned = new ScannedGenericBeanDefinition(
new SimpleMetadataReaderFactory()
.getMetadataReader(CustomNameFilter.class.getName()));
this.handler.handle(scanned, this.registry);
BeanDefinition filterRegistrationBean = this.registry.getBeanDefinition("custom");
MutablePropertyValues propertyValues = filterRegistrationBean.getPropertyValues();
assertThat(propertyValues.get("name")).isEqualTo("custom");
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:WebFilterHandlerTests.java
示例14: servletWithCustomName
import org.springframework.context.annotation.ScannedGenericBeanDefinition; //导入依赖的package包/类
@Test
public void servletWithCustomName() throws IOException {
ScannedGenericBeanDefinition scanned = new ScannedGenericBeanDefinition(
new SimpleMetadataReaderFactory()
.getMetadataReader(CustomNameServlet.class.getName()));
this.handler.handle(scanned, this.registry);
BeanDefinition servletRegistrationBean = this.registry
.getBeanDefinition("custom");
MutablePropertyValues propertyValues = servletRegistrationBean
.getPropertyValues();
assertThat(propertyValues.get("name"), is((Object) "custom"));
}
示例15: filterWithCustomName
import org.springframework.context.annotation.ScannedGenericBeanDefinition; //导入依赖的package包/类
@Test
public void filterWithCustomName() throws IOException {
ScannedGenericBeanDefinition scanned = new ScannedGenericBeanDefinition(
new SimpleMetadataReaderFactory()
.getMetadataReader(CustomNameFilter.class.getName()));
this.handler.handle(scanned, this.registry);
BeanDefinition filterRegistrationBean = this.registry.getBeanDefinition("custom");
MutablePropertyValues propertyValues = filterRegistrationBean.getPropertyValues();
assertThat(propertyValues.get("name"), is((Object) "custom"));
}