Class CliComponentScanConfig

java.lang.Object
ubic.gemma.cli.config.CliComponentScanConfig

@Configuration @Profile("cli") @ComponentScan(basePackages="ubic.gemma.cli",nameGenerator=ubic.gemma.core.context.BeanNameGenerator.class,excludeFilters=) @ComponentScan(basePackages="ubic.gemma.apps",nameGenerator=ubic.gemma.core.context.BeanNameGenerator.class,useDefaultFilters=false,scopeResolver=PrototypeScopeResolver.class,includeFilters=,excludeFilters=) @ComponentScan(basePackages="ubic.gemma.contrib.apps",nameGenerator=ubic.gemma.core.context.BeanNameGenerator.class,useDefaultFilters=false,scopeResolver=PrototypeScopeResolver.class,includeFilters=,excludeFilters=) public class CliComponentScanConfig extends Object
Component-scan configuration for the gemma-cli module, replacing the XML <context:component-scan> blocks previously declared in applicationContext-component-scan.xml.

Three scans, matching the legacy XML exactly:

  1. ubic.gemma.cli — standard stereotype scan with the TestComponent exclude filter. Picks up CLI-specific @Component/@Service/etc. beans.
  2. ubic.gemma.apps — restricted scan: default filters off, include filter on the CLI interface (assignable type), with PrototypeScopeResolver so each CLI tool is created per-invocation rather than as a singleton. This is how the in-tree CLI tools get registered.
  3. ubic.gemma.contrib.apps — identical to (2), for out-of-tree CLI tools dropped into the contrib classpath.
All three use Gemma's custom BeanNameGenerator (camel-case, strips trailing "Impl") to match the legacy XML's name-generator attribute.

Also re-declares the LazyInitByDefaultPostProcessor bean that the XML defined as a bare <bean class="..."/>; the post-processor must be returned from a static @Bean method so the container instantiates it before the @Configuration class is fully populated (it's a BeanFactoryPostProcessor).

The whole configuration is gated on the cli profile, matching the legacy XML's profile="cli" attribute, so the CLI scans don't fire in web/REST contexts.

Wired in applicationContext-component-scan.xml as a <bean> so the existing wildcard XML loader (classpath*:ubic/gemma/applicationContext-*.xml — see SpringContextUtils and the various CLI bootstrap paths) still discovers it without classpath-order surgery.

  • Constructor Details

    • CliComponentScanConfig

      public CliComponentScanConfig()
  • Method Details

    • lazyInitByDefaultPostProcessor

      @Bean public static ubic.gemma.core.context.LazyInitByDefaultPostProcessor lazyInitByDefaultPostProcessor()
      Re-creates the bare <bean class="ubic.gemma.core.context.LazyInitByDefaultPostProcessor"/> from the legacy XML. Must be static because the bean is a BeanFactoryPostProcessor and Spring needs to instantiate it before the enclosing @Configuration is processed.