eu.etaxonomy.cdm.remote.config
Class DataSourceConfigurer
java.lang.Object
eu.etaxonomy.cdm.remote.config.AbstractWebApplicationConfigurer
eu.etaxonomy.cdm.remote.config.DataSourceConfigurer
@Configuration
public class DataSourceConfigurer
- extends AbstractWebApplicationConfigurer
The DataSourceConfigurer can be used as a replacement for a xml configuration in the application context.
Enter the following in your application context configuration in order to enable the DataSourceConfigurer:
<!-- enable processing of annotations such as @Autowired and @Configuration -->
<context:annotation-config/>
<bean class="eu.etaxonomy.cdm.remote.config.DataSourceConfigurer" >
</bean>
The DataSourceConfigurer allows alternative ways to specify a data source:
- Specify the data source bean to use in the Java environment properties:
-Dcdm.datasource={dataSourceName} (ATTRIBUTE_DATASOURCE_NAME).
The data source bean with the given name will then be loaded from the cdm.beanDefinitionFile
(CDM_BEAN_DEFINITION_FILE), which must be a valid Spring bean definition file.
-
Use a JDBC data source which is bound into the JNDI context. In this case the JNDI name is specified
via the
ATTRIBUTE_JDBC_JNDI_NAME as attribute to the ServletContext.
This scenario usually being used by the cdm-server application.
The attributes used in (1) and (2) are in a first step being searched in the ServletContext
if not found search in a second step in the environment variables of the OS, see:AbstractWebApplicationConfigurer.findProperty(String, boolean).
- Author:
- a.kohlbecker
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
public static final Logger logger
ATTRIBUTE_JDBC_JNDI_NAME
protected static final String ATTRIBUTE_JDBC_JNDI_NAME
- See Also:
- Constant Field Values
HIBERNATE_DIALECT
protected static final String HIBERNATE_DIALECT
- See Also:
- Constant Field Values
HIBERNATE_SEARCH_DEFAULT_INDEX_BASE
protected static final String HIBERNATE_SEARCH_DEFAULT_INDEX_BASE
- See Also:
- Constant Field Values
CDM_BEAN_DEFINITION_FILE
protected static final String CDM_BEAN_DEFINITION_FILE
- See Also:
- Constant Field Values
ATTRIBUTE_DATASOURCE_NAME
protected static final String ATTRIBUTE_DATASOURCE_NAME
- Attribute to configure the name of the data source as set as bean name in the datasources.xml.
This name usually is used as the prefix for the webapplication root path.
This is a required attribute!
- See Also:
AbstractWebApplicationConfigurer.findProperty(String, boolean),
Constant Field Values
DATASOURCE_BEANDEF_DEFAULT
protected static final String DATASOURCE_BEANDEF_DEFAULT
beanDefinitionFile
protected static String beanDefinitionFile
DataSourceConfigurer
public DataSourceConfigurer()
setBeanDefinitionFile
public void setBeanDefinitionFile(String filename)
- The file to load the
DataSource beans from.
This file is usually ./.cdmLibrary/datasources.xml
- Parameters:
filename -
dataSource
@Bean
public DataSource dataSource()
dataSourceProperties
@Bean
public DataSourceProperties dataSourceProperties()
hibernateProperties
@Bean
public Properties hibernateProperties()
inferHibernateDialectName
public String inferHibernateDialectName()
Copyright © 2007-2013 EDIT. All Rights Reserved.