package com.github.yingzhuo.spring.auto.mybatis;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import java.io.IOException;
import java.io.Serializable;
@ConfigurationProperties(prefix = "spring.auto.mybatis")
public class ConfigBean implements Serializable, InitializingBean {
private Resource configLocation = new ClassPathResource("mybatis.cnf.xml");
private boolean failFast = true;
private String executorType = "SIMPLE";
private boolean useExceptionTranslator = true;
public ConfigBean() {
super();
}
@Override
public void afterPropertiesSet() throws Exception {
if (!configLocation.exists()) {
throw new IOException(configLocation + " NOT found.");
}
}
public Resource getConfigLocation() {
return configLocation;
}
public void setConfigLocation(Resource configLocation) {
this.configLocation = configLocation;
}
public boolean isFailFast() {
return failFast;
}
public void setFailFast(boolean failFast) {
this.failFast = failFast;
}
public String getExecutorType() {
return executorType;
}
public void setExecutorType(String executorType) {
this.executorType = executorType;
}
public boolean isUseExceptionTranslator() {
return useExceptionTranslator;
}
public void setUseExceptionTranslator(boolean useExceptionTranslator) {
this.useExceptionTranslator = useExceptionTranslator;
}
}