Package io.micronaut.jdbc
Class BaseDatasourceFactory
java.lang.Object
io.micronaut.jdbc.BaseDatasourceFactory
- All Implemented Interfaces:
io.micronaut.context.event.ApplicationEventListener<io.micronaut.runtime.context.scope.refresh.RefreshEvent>,io.micronaut.core.order.Ordered,io.micronaut.runtime.context.scope.refresh.RefreshEventListener,EventListener
- Direct Known Subclasses:
DatasourceFactory,DatasourceFactory,DatasourceFactory,DatasourceFactory
@Internal
public abstract class BaseDatasourceFactory
extends Object
implements io.micronaut.runtime.context.scope.refresh.RefreshEventListener
An abstract base class for datasource factories that listens for refresh events and updates datasource credentials accordingly.
This class provides a basic implementation for handling refresh events and updating datasource credentials.
Subclasses are expected to implement the dataSourceCredentialsChanged(String, DataSourceCredentials) method to handle the updated credentials.
- Since:
- 6.2.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final recordA record representing datasource credentials. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final io.micronaut.context.ApplicationContextFields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCEFields inherited from interface io.micronaut.runtime.context.scope.refresh.RefreshEventListener
DEFAULT_POSITION -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBaseDatasourceFactory(io.micronaut.context.ApplicationContext applicationContext) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voiddataSourceCredentialsChanged(String dataSourceName, BaseDatasourceFactory.DataSourceCredentials dataSourceCredentials) Called when the datasource credentials have changed.voidonApplicationEvent(io.micronaut.runtime.context.scope.refresh.RefreshEvent event) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.runtime.context.scope.refresh.RefreshEventListener
getOrder, supports
-
Field Details
-
applicationContext
protected final io.micronaut.context.ApplicationContext applicationContext
-
-
Constructor Details
-
BaseDatasourceFactory
protected BaseDatasourceFactory(io.micronaut.context.ApplicationContext applicationContext)
-
-
Method Details
-
getObservedConfigurationPrefixes
- Specified by:
getObservedConfigurationPrefixesin interfaceio.micronaut.runtime.context.scope.refresh.RefreshEventListener
-
onApplicationEvent
public void onApplicationEvent(io.micronaut.runtime.context.scope.refresh.RefreshEvent event) - Specified by:
onApplicationEventin interfaceio.micronaut.context.event.ApplicationEventListener<io.micronaut.runtime.context.scope.refresh.RefreshEvent>
-
dataSourceCredentialsChanged
protected abstract void dataSourceCredentialsChanged(String dataSourceName, BaseDatasourceFactory.DataSourceCredentials dataSourceCredentials) Called when the datasource credentials have changed.Subclasses must implement this method to handle the updated credentials.
- Parameters:
dataSourceName- the name of the datasourcedataSourceCredentials- the updated datasource credentials
-