/** * Register the {@link Configuration} class itself as a bean definition. */ private void registerBeanDefinitionForImportedConfigurationClass(ConfigurationClass configClass) { AnnotationMetadata metadata = configClass.getMetadata(); BeanDefinition configBeanDef = new AnnotatedGenericBeanDefinition(metadata); if (ConfigurationClassUtils.checkConfigurationClassCandidate(configBeanDef, this.metadataReaderFactory)) { String configBeanName = this.importBeanNameGenerator.generateBeanName(configBeanDef, this.registry); this.registry.registerBeanDefinition(configBeanName, configBeanDef); configClass.setBeanName(configBeanName); if (logger.isDebugEnabled()) { logger.debug(String.format("Registered bean definition for imported @Configuration class %s", configBeanName)); } } else { this.problemReporter.error( new InvalidConfigurationImportProblem(metadata.getClassName(), configClass.getResource(), metadata)); } }
/** * Register the {@link Configuration} class itself as a bean definition. */ private void registerBeanDefinitionForImportedConfigurationClass(ConfigurationClass configClass) { AnnotationMetadata metadata = configClass.getMetadata(); AnnotatedGenericBeanDefinition configBeanDef = new AnnotatedGenericBeanDefinition(metadata); ScopeMetadata scopeMetadata = scopeMetadataResolver.resolveScopeMetadata(configBeanDef); configBeanDef.setScope(scopeMetadata.getScopeName()); String configBeanName = this.importBeanNameGenerator.generateBeanName(configBeanDef, this.registry); AnnotationConfigUtils.processCommonDefinitionAnnotations(configBeanDef, metadata); BeanDefinitionHolder definitionHolder = new BeanDefinitionHolder(configBeanDef, configBeanName); definitionHolder = AnnotationConfigUtils.applyScopedProxyMode(scopeMetadata, definitionHolder, this.registry); this.registry.registerBeanDefinition(definitionHolder.getBeanName(), definitionHolder.getBeanDefinition()); configClass.setBeanName(configBeanName); if (logger.isDebugEnabled()) { logger.debug("Registered bean definition for imported class '" + configBeanName + "'"); } }
@Test public void testViewScopedClass() { GenericApplicationContext acx = new GenericApplicationContext(); AnnotationConfigUtils.registerAnnotationConfigProcessors(acx); acx.registerBeanDefinition("viewScopedClass", new AnnotatedGenericBeanDefinition( new StandardAnnotationMetadata(ViewScopedClass.class))); acx.registerBeanDefinition("scopedBeansConfiguration", new RootBeanDefinition( ScopedBeansConfiguration.class)); acx.addBeanFactoryPostProcessor(JsfScopeAnnotationsAutoConfiguration.jsfScopeAnnotationsConfigurer(acx.getEnvironment())); acx.addBeanFactoryPostProcessor(CdiScopeAnnotationsAutoConfiguration.cdiScopeAnnotationsConfigurer(acx.getEnvironment())); acx.refresh(); assertThat(acx.getBeanDefinition("viewScopedClass").getScope()) .isEqualTo(ViewScope.SCOPE_VIEW); assertThat(acx.getBeanDefinition("viewScopedBean").getScope()) .isEqualTo(ViewScope.SCOPE_VIEW); }
@Test public void testSessionScopedClass() { GenericApplicationContext acx = new GenericApplicationContext(); AnnotationConfigUtils.registerAnnotationConfigProcessors(acx); acx.registerBeanDefinition("sessionScopedClass", new AnnotatedGenericBeanDefinition( new StandardAnnotationMetadata(SessionScopedClass.class))); acx.registerBeanDefinition("scopedBeansConfiguration", new RootBeanDefinition( ScopedBeansConfiguration.class)); acx.addBeanFactoryPostProcessor(JsfScopeAnnotationsAutoConfiguration.jsfScopeAnnotationsConfigurer(acx.getEnvironment())); acx.addBeanFactoryPostProcessor(CdiScopeAnnotationsAutoConfiguration.cdiScopeAnnotationsConfigurer(acx.getEnvironment())); acx.refresh(); assertThat(acx.getBeanDefinition("sessionScopedClass").getScope()) .isEqualTo(WebApplicationContext.SCOPE_SESSION); assertThat(acx.getBeanDefinition("sessionScopedBean").getScope()) .isEqualTo(WebApplicationContext.SCOPE_SESSION); }
@Test public void testNoScopedClass() { GenericApplicationContext acx = new GenericApplicationContext(); AnnotationConfigUtils.registerAnnotationConfigProcessors(acx); acx.registerBeanDefinition("noScopedClass", new AnnotatedGenericBeanDefinition( new StandardAnnotationMetadata(NoScopedClass.class))); acx.registerBeanDefinition("scopedBeansConfiguration", new RootBeanDefinition( ScopedBeansConfiguration.class)); acx.addBeanFactoryPostProcessor(JsfScopeAnnotationsAutoConfiguration.jsfScopeAnnotationsConfigurer(acx.getEnvironment())); acx.addBeanFactoryPostProcessor(CdiScopeAnnotationsAutoConfiguration.cdiScopeAnnotationsConfigurer(acx.getEnvironment())); acx.refresh(); assertThat(acx.getBeanDefinition("noScopedClass").getScope()) .isEqualTo(""); assertThat(acx.getBeanDefinition("noScopedBean").getScope()) .isEqualTo(""); }
public void registerBean(Class<?> annotatedClass, String name, @SuppressWarnings("unchecked") Class<? extends Annotation>... qualifiers) { AnnotatedGenericBeanDefinition abd = new AnnotatedGenericBeanDefinition(annotatedClass); if (this.conditionEvaluator.shouldSkip(abd.getMetadata())) { return; } ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(abd); abd.setScope(scopeMetadata.getScopeName()); String beanName = (name != null ? name : this.beanNameGenerator.generateBeanName(abd, this.registry)); AnnotationConfigUtils.processCommonDefinitionAnnotations(abd); if (qualifiers != null) { for (Class<? extends Annotation> qualifier : qualifiers) { if (Primary.class.equals(qualifier)) { abd.setPrimary(true); } else if (Lazy.class.equals(qualifier)) { abd.setLazyInit(true); } else { abd.addQualifier(new AutowireCandidateQualifier(qualifier)); } } } BeanDefinitionHolder definitionHolder = new BeanDefinitionHolder(abd, beanName); definitionHolder = AnnotationConfigUtils.applyScopedProxyMode(scopeMetadata, definitionHolder, this.registry); BeanDefinitionReaderUtils.registerBeanDefinition(definitionHolder, this.registry); }
@Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { System.out.println("------ register custom bean in BeanFactoryPostProcessor"); beanFactory.registerSingleton("createByBeanFactoryPostProcessor", new SimpleBeanInBeanFactoryPostProcessor()); if(beanFactory instanceof BeanDefinitionRegistry) { BeanDefinitionReaderUtils.registerBeanDefinition( new BeanDefinitionHolder(new AnnotatedGenericBeanDefinition(SimpleBeanWithDefinitionInBeanFactoryPostProcessor.class), "simpleBeanWithDefinitionInBeanFactoryPostProcessor"), (BeanDefinitionRegistry) beanFactory ); } }
public void registerBean(Class<?> annotatedClass, String name, @SuppressWarnings("unchecked") Class<? extends Annotation>... qualifiers) { AnnotatedGenericBeanDefinition abd = new AnnotatedGenericBeanDefinition(annotatedClass); if (this.conditionEvaluator.shouldSkip(abd.getMetadata())) { return; } ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(abd); abd.setScope(scopeMetadata.getScopeName()); String beanName = (name != null ? name : this.beanNameGenerator.generateBeanName(abd, this.registry)); AnnotationConfigUtils.processCommonDefinitionAnnotations(abd); if (qualifiers != null) { for (Class<? extends Annotation> qualifier : qualifiers) { if (Primary.class == qualifier) { abd.setPrimary(true); } else if (Lazy.class == qualifier) { abd.setLazyInit(true); } else { abd.addQualifier(new AutowireCandidateQualifier(qualifier)); } } } BeanDefinitionHolder definitionHolder = new BeanDefinitionHolder(abd, beanName); definitionHolder = AnnotationConfigUtils.applyScopedProxyMode(scopeMetadata, definitionHolder, this.registry); BeanDefinitionReaderUtils.registerBeanDefinition(definitionHolder, this.registry); }
@Test public void resolveScopeMetadataShouldNotApplyScopedProxyModeToSingleton() { AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithSingletonScope.class); ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd); assertNotNull("resolveScopeMetadata(..) must *never* return null.", scopeMetadata); assertEquals(BeanDefinition.SCOPE_SINGLETON, scopeMetadata.getScopeName()); assertEquals(NO, scopeMetadata.getScopedProxyMode()); }
@Test public void resolveScopeMetadataShouldApplyScopedProxyModeToPrototype() { this.scopeMetadataResolver = new AnnotationScopeMetadataResolver(INTERFACES); AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithPrototypeScope.class); ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd); assertNotNull("resolveScopeMetadata(..) must *never* return null.", scopeMetadata); assertEquals(BeanDefinition.SCOPE_PROTOTYPE, scopeMetadata.getScopeName()); assertEquals(INTERFACES, scopeMetadata.getScopedProxyMode()); }
@Test public void resolveScopeMetadataShouldReadScopedProxyModeFromAnnotation() { AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithScopedProxy.class); ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd); assertNotNull("resolveScopeMetadata(..) must *never* return null.", scopeMetadata); assertEquals("request", scopeMetadata.getScopeName()); assertEquals(TARGET_CLASS, scopeMetadata.getScopedProxyMode()); }
@Test public void customRequestScope() { AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithCustomRequestScope.class); ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd); assertNotNull("resolveScopeMetadata(..) must *never* return null.", scopeMetadata); assertEquals("request", scopeMetadata.getScopeName()); assertEquals(NO, scopeMetadata.getScopedProxyMode()); }
@Test public void customRequestScopeViaAsm() throws IOException { MetadataReaderFactory readerFactory = new SimpleMetadataReaderFactory(); MetadataReader reader = readerFactory.getMetadataReader(AnnotatedWithCustomRequestScope.class.getName()); AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(reader.getAnnotationMetadata()); ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd); assertNotNull("resolveScopeMetadata(..) must *never* return null.", scopeMetadata); assertEquals("request", scopeMetadata.getScopeName()); assertEquals(NO, scopeMetadata.getScopedProxyMode()); }
@Test public void customRequestScopeWithAttribute() { AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition( AnnotatedWithCustomRequestScopeWithAttributeOverride.class); ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd); assertNotNull("resolveScopeMetadata(..) must *never* return null.", scopeMetadata); assertEquals("request", scopeMetadata.getScopeName()); assertEquals(TARGET_CLASS, scopeMetadata.getScopedProxyMode()); }
@Test public void customRequestScopeWithAttributeViaAsm() throws IOException { MetadataReaderFactory readerFactory = new SimpleMetadataReaderFactory(); MetadataReader reader = readerFactory.getMetadataReader(AnnotatedWithCustomRequestScopeWithAttributeOverride.class.getName()); AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(reader.getAnnotationMetadata()); ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd); assertNotNull("resolveScopeMetadata(..) must *never* return null.", scopeMetadata); assertEquals("request", scopeMetadata.getScopeName()); assertEquals(TARGET_CLASS, scopeMetadata.getScopedProxyMode()); }
@Test public void generateBeanNameWithNamedComponent() { BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry(); AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentWithName.class); String beanName = this.beanNameGenerator.generateBeanName(bd, registry); assertNotNull("The generated beanName must *never* be null.", beanName); assertTrue("The generated beanName must *never* be blank.", StringUtils.hasText(beanName)); assertEquals("walden", beanName); }
@Test public void generateBeanNameWithDefaultNamedComponent() { BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry(); AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(DefaultNamedComponent.class); String beanName = this.beanNameGenerator.generateBeanName(bd, registry); assertNotNull("The generated beanName must *never* be null.", beanName); assertTrue("The generated beanName must *never* be blank.", StringUtils.hasText(beanName)); assertEquals("thoreau", beanName); }
@Test public void generateBeanNameWithNamedComponentWhereTheNameIsBlank() { BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry(); AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentWithBlankName.class); String beanName = this.beanNameGenerator.generateBeanName(bd, registry); assertNotNull("The generated beanName must *never* be null.", beanName); assertTrue("The generated beanName must *never* be blank.", StringUtils.hasText(beanName)); String expectedGeneratedBeanName = this.beanNameGenerator.buildDefaultBeanName(bd); assertEquals(expectedGeneratedBeanName, beanName); }
@Test public void generateBeanNameWithAnonymousComponentYieldsGeneratedBeanName() { BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry(); AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnonymousComponent.class); String beanName = this.beanNameGenerator.generateBeanName(bd, registry); assertNotNull("The generated beanName must *never* be null.", beanName); assertTrue("The generated beanName must *never* be blank.", StringUtils.hasText(beanName)); String expectedGeneratedBeanName = this.beanNameGenerator.buildDefaultBeanName(bd); assertEquals(expectedGeneratedBeanName, beanName); }
@Test public void generateBeanNameFromMetaComponentWithStringValue() { BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry(); AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentFromStringMeta.class); String beanName = this.beanNameGenerator.generateBeanName(bd, registry); assertEquals("henry", beanName); }
@Test public void generateBeanNameFromMetaComponentWithNonStringValue() { BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry(); AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentFromNonStringMeta.class); String beanName = this.beanNameGenerator.generateBeanName(bd, registry); assertEquals("annotationBeanNameGeneratorTests.ComponentFromNonStringMeta", beanName); }
/** * @since 4.0.1 * @see https://jira.spring.io/browse/SPR-11360 */ @Test public void generateBeanNameFromComposedControllerAnnotationWithoutName() { BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry(); AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComposedControllerAnnotationWithoutName.class); String beanName = this.beanNameGenerator.generateBeanName(bd, registry); String expectedGeneratedBeanName = this.beanNameGenerator.buildDefaultBeanName(bd); assertEquals(expectedGeneratedBeanName, beanName); }
/** * @since 4.0.1 * @see https://jira.spring.io/browse/SPR-11360 */ @Test public void generateBeanNameFromComposedControllerAnnotationWithBlankName() { BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry(); AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComposedControllerAnnotationWithBlankName.class); String beanName = this.beanNameGenerator.generateBeanName(bd, registry); String expectedGeneratedBeanName = this.beanNameGenerator.buildDefaultBeanName(bd); assertEquals(expectedGeneratedBeanName, beanName); }
/** * @since 4.0.1 * @see https://jira.spring.io/browse/SPR-11360 */ @Test public void generateBeanNameFromComposedControllerAnnotationWithStringValue() { BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry(); AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition( ComposedControllerAnnotationWithStringValue.class); String beanName = this.beanNameGenerator.generateBeanName(bd, registry); assertEquals("restController", beanName); }
@Test public void emptyFactoryMethodMetadataIgnored() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); DataSource dataSource = mock(DataSource.class); AnnotatedGenericBeanDefinition beanDefinition = new AnnotatedGenericBeanDefinition( dataSource.getClass()); context.registerBeanDefinition("dataSource", beanDefinition); context.register(DataSourcePropertiesConfiguration.class); context.register(DevToolsDataSourceAutoConfiguration.class); context.refresh(); context.close(); }
private void registerBean(BeanDefinitionRegistry registry, String name,Class<?> beanClass) { AnnotatedGenericBeanDefinition abd = new AnnotatedGenericBeanDefinition(beanClass); ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(abd); abd.setScope(scopeMetadata.getScopeName()); // 可以自动生成name String beanName = (name != null ? name : this.beanNameGenerator.generateBeanName(abd, registry)); AnnotationConfigUtils.processCommonDefinitionAnnotations(abd); BeanDefinitionHolder definitionHolder = new BeanDefinitionHolder(abd,beanName); BeanDefinitionReaderUtils.registerBeanDefinition(definitionHolder,registry); }
private static void initAnnotatedConf(GenericApplicationContext context){ Class componentScanAnnotated=ProcessInfo.getAnnotationInitClass(); if(componentScanAnnotated!=null){ AnnotatedGenericBeanDefinition def=new AnnotatedGenericBeanDefinition(ProcessInfo.getAnnotationInitClass()); AnnotatedBeanDefinitionReader reader=new AnnotatedBeanDefinitionReader(context); AnnotationScopeMetadataResolver resolver=new AnnotationScopeMetadataResolver(); resolver.resolveScopeMetadata(def); reader.setScopeMetadataResolver(resolver); } }
private Set<BeanDefinition> findKopBeanComponents(String basePackage){ boolean debugEnabled = logger.isDebugEnabled(); Set<BeanDefinition> candidates = new LinkedHashSet<BeanDefinition>(); List<String> classes = null; if(basePackage.contains("com.linda.koala.biz.dao")){ classes = this.getDaoClasses(); }else if(basePackage.contains("com.linda.koala.biz")){ classes = this.getBizClasses(); } if(classes!=null){ for(String clazz:classes){ ClassLoader loader = this.getClass().getClassLoader(); try { Class<?> class1 = loader.loadClass(clazz); if(class1!=null){ AnnotatedGenericBeanDefinition beanDefinition = new AnnotatedGenericBeanDefinition(class1); if (isCandidateComponent(beanDefinition)) { if (debugEnabled) { logger.debug("Identified candidate component class: " + clazz); } candidates.add(beanDefinition); } else { if (debugEnabled) { logger.debug("Ignored because not a concrete top-level class: " +clazz); } } } } catch (ClassNotFoundException e) { throw new BeanDefinitionStoreException("Failed to read candidate component class: " + clazz, e); } } } return candidates; }
/** * loadClass: Loads the route class into the bean defn registry. * @param bdr * @param className */ private void loadClass(BeanDefinitionRegistry bdr, String className) { try { // try using the class loader to load the given route class Class<?> clazz = Class.forName(className); // define it in the registry under it's own class name. bdr.registerBeanDefinition(className, new AnnotatedGenericBeanDefinition(clazz)); } catch (ClassNotFoundException e) { _logger.error("XSF Route Registrator could not locate class="+className, e); } }
public void registerBean(Class<?> annotatedClass, String name, Class<? extends Annotation>... qualifiers) { AnnotatedGenericBeanDefinition abd = new AnnotatedGenericBeanDefinition(annotatedClass); AnnotationMetadata metadata = abd.getMetadata(); if (metadata.isAnnotated(Profile.class.getName())) { AnnotationAttributes profile = MetadataUtils.attributesFor(metadata, Profile.class); if (!this.environment.acceptsProfiles(profile.getStringArray("value"))) { return; } } ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(abd); abd.setScope(scopeMetadata.getScopeName()); String beanName = (name != null ? name : this.beanNameGenerator.generateBeanName(abd, this.registry)); AnnotationConfigUtils.processCommonDefinitionAnnotations(abd); if (qualifiers != null) { for (Class<? extends Annotation> qualifier : qualifiers) { if (Primary.class.equals(qualifier)) { abd.setPrimary(true); } else if (Lazy.class.equals(qualifier)) { abd.setLazyInit(true); } else { abd.addQualifier(new AutowireCandidateQualifier(qualifier)); } } } BeanDefinitionHolder definitionHolder = new BeanDefinitionHolder(abd, beanName); definitionHolder = AnnotationConfigUtils.applyScopedProxyMode(scopeMetadata, definitionHolder, this.registry); BeanDefinitionReaderUtils.registerBeanDefinition(definitionHolder, this.registry); }
@Test public void testThatResolveScopeMetadataDoesNotApplyScopedProxyModeToASingleton() { AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithSingletonScope.class); ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd); assertNotNull("resolveScopeMetadata(..) must *never* return null.", scopeMetadata); assertEquals(BeanDefinition.SCOPE_SINGLETON, scopeMetadata.getScopeName()); assertEquals(ScopedProxyMode.NO, scopeMetadata.getScopedProxyMode()); }
@Test public void testThatResolveScopeMetadataDoesApplyScopedProxyModeToAPrototype() { this.scopeMetadataResolver = new AnnotationScopeMetadataResolver(ScopedProxyMode.INTERFACES); AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithPrototypeScope.class); ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd); assertNotNull("resolveScopeMetadata(..) must *never* return null.", scopeMetadata); assertEquals(BeanDefinition.SCOPE_PROTOTYPE, scopeMetadata.getScopeName()); assertEquals(ScopedProxyMode.INTERFACES, scopeMetadata.getScopedProxyMode()); }
@Test public void testThatResolveScopeMetadataDoesReadScopedProxyModeFromTheAnnotation() { this.scopeMetadataResolver = new AnnotationScopeMetadataResolver(); AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithScopedProxy.class); ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd); assertNotNull("resolveScopeMetadata(..) must *never* return null.", scopeMetadata); assertEquals("request", scopeMetadata.getScopeName()); assertEquals(ScopedProxyMode.TARGET_CLASS, scopeMetadata.getScopedProxyMode()); }
@Test public void testCustomRequestScope() { AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithCustomRequestScope.class); ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd); assertNotNull("resolveScopeMetadata(..) must *never* return null.", scopeMetadata); assertEquals("request", scopeMetadata.getScopeName()); assertEquals(ScopedProxyMode.NO, scopeMetadata.getScopedProxyMode()); }