Skip to content

Commit

Permalink
Pass engine configuration to typeHandler and typeAlias to retrieve co…
Browse files Browse the repository at this point in the history
…nfiguration settings if needed
  • Loading branch information
jbarrez committed Sep 11, 2024
1 parent 1b0d115 commit 49b47e4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -960,12 +960,12 @@ protected void applyCustomMybatisCustomizations(Configuration configuration) {

if (dependentEngineMybatisTypeAliasConfigs != null) {
for (MybatisTypeAliasConfigurator typeAliasConfig : dependentEngineMybatisTypeAliasConfigs) {
typeAliasConfig.configure(configuration.getTypeAliasRegistry());
typeAliasConfig.configure(this, configuration.getTypeAliasRegistry());
}
}
if (dependentEngineMybatisTypeHandlerConfigs != null) {
for (MybatisTypeHandlerConfigurator typeHandlerConfig : dependentEngineMybatisTypeHandlerConfigs) {
typeHandlerConfig.configure(configuration.getTypeHandlerRegistry());
typeHandlerConfig.configure(this, configuration.getTypeHandlerRegistry());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ protected void registerCustomMybatisMappings(AbstractEngineConfiguration engineC
Node node = typeAliasList.item(i);
MybatisTypeAliasConfigurator typeAlias = new MybatisTypeAliasConfigurator() {
@Override
public void configure(TypeAliasRegistry typeAliasRegistry) {
public void configure(AbstractEngineConfiguration abstractEngineConfiguration, TypeAliasRegistry typeAliasRegistry) {
try {
typeAliasRegistry.registerAlias(node.getAttributes().getNamedItem("alias").getTextContent(),
Class.forName(node.getAttributes().getNamedItem("type").getTextContent()));
Expand All @@ -131,7 +131,7 @@ public void configure(TypeAliasRegistry typeAliasRegistry) {
Node node = typeHandlerList.item(i);
MybatisTypeHandlerConfigurator typeHandler = new MybatisTypeHandlerConfigurator() {
@Override
public void configure(TypeHandlerRegistry typeHandlerRegistry) {
public void configure(AbstractEngineConfiguration abstractEngineConfiguration, TypeHandlerRegistry typeHandlerRegistry) {
try {
typeHandlerRegistry.register(node.getAttributes().getNamedItem("javaType").getTextContent(),
node.getAttributes().getNamedItem("handler").getTextContent());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
package org.flowable.common.engine.impl.db;

import org.apache.ibatis.type.TypeAliasRegistry;
import org.flowable.common.engine.impl.AbstractEngineConfiguration;

/**
* This class configures typeAliases in {@link TypeAliasRegistry}
Expand All @@ -21,5 +22,5 @@
*/
public interface MybatisTypeAliasConfigurator {

void configure(TypeAliasRegistry typeAliasRegistry);
void configure(AbstractEngineConfiguration engineConfiguration, TypeAliasRegistry typeAliasRegistry);
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import org.apache.ibatis.type.TypeHandler;
import org.apache.ibatis.type.TypeHandlerRegistry;
import org.flowable.common.engine.impl.AbstractEngineConfiguration;

/**
* This class configures {@link TypeHandler} in {@link TypeHandlerRegistry}
Expand All @@ -22,5 +23,5 @@
*/
public interface MybatisTypeHandlerConfigurator {

void configure(TypeHandlerRegistry typeHandlerRegistry);
void configure(AbstractEngineConfiguration engineConfiguration, TypeHandlerRegistry typeHandlerRegistry);
}

0 comments on commit 49b47e4

Please sign in to comment.