com.github.yt.mybatis.config.fields.FieldsConfiguration Maven / Gradle / Ivy
package com.github.yt.mybatis.config.fields;
import com.github.yt.mybatis.utils.SpringContextUtils;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
public class FieldsConfiguration {
private static FieldsDefault fieldsDefault;
public static FieldsDefault create() {
if (fieldsDefault != null) {
return fieldsDefault;
}
Object object = null;
boolean error = false;
try {
object = SpringContextUtils.getBean("ytFieldsDefault");
} catch (NoSuchBeanDefinitionException e) {
error = true;
}
if (error || object == null) {
fieldsDefault = (FieldsDefault) SpringContextUtils.getBean("defaultFieldsDefault");
} else {
fieldsDefault = (FieldsDefault) object;
}
return fieldsDefault;
}
}