Class PropertiesBasedNamedQueriesFactoryBean

java.lang.Object
org.springframework.core.io.support.PropertiesLoaderSupport
org.springframework.data.repository.config.PropertiesBasedNamedQueriesFactoryBean
All Implemented Interfaces:
org.springframework.beans.factory.FactoryBean<PropertiesBasedNamedQueries>, org.springframework.beans.factory.InitializingBean

public class PropertiesBasedNamedQueriesFactoryBean extends org.springframework.core.io.support.PropertiesLoaderSupport implements org.springframework.beans.factory.FactoryBean<PropertiesBasedNamedQueries>, org.springframework.beans.factory.InitializingBean
Factory bean to create PropertiesBasedNamedQueries.

Supports loading from a properties file and/or setting local properties on this FactoryBean. The created Properties instance will be merged from loaded and local values. If neither a location nor local properties are set, an exception will be thrown on initialization.

Can create a singleton or a new object on each request. Default is a singleton.

Since:
3.0
Author:
Mark Paluch
  • Constructor Details

    • PropertiesBasedNamedQueriesFactoryBean

      public PropertiesBasedNamedQueriesFactoryBean()
  • Method Details

    • setSingleton

      public void setSingleton(boolean singleton)
      Set whether a shared singleton PropertiesBasedNamedQueries instance should be created, or rather a new PropertiesBasedNamedQueries instance on each request.

      Default is true (a shared singleton).

    • isSingleton

      public boolean isSingleton()
      Specified by:
      isSingleton in interface org.springframework.beans.factory.FactoryBean<PropertiesBasedNamedQueries>
    • afterPropertiesSet

      public void afterPropertiesSet() throws IOException
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      IOException
    • getObject

      @Nullable public PropertiesBasedNamedQueries getObject() throws IOException
      Specified by:
      getObject in interface org.springframework.beans.factory.FactoryBean<PropertiesBasedNamedQueries>
      Throws:
      IOException
    • getObjectType

      public Class<PropertiesBasedNamedQueries> getObjectType()
      Specified by:
      getObjectType in interface org.springframework.beans.factory.FactoryBean<PropertiesBasedNamedQueries>
    • createProperties

      protected Properties createProperties() throws IOException
      Throws:
      IOException