ca.pjer.spring.boot.jdbi.SqlObjectFactoryBean Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jdbi-spring-boot-starter Show documentation
Show all versions of jdbi-spring-boot-starter Show documentation
This is a Spring Boot Starter for auto creating Jdbi and SqlObject
The newest version!
package ca.pjer.spring.boot.jdbi;
import org.jdbi.v3.core.Jdbi;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
@SuppressWarnings("unused")
public class SqlObjectFactoryBean implements FactoryBean, InitializingBean {
private Jdbi jdbi;
private Class type;
private Object object;
private Jdbi getJdbi() {
return jdbi;
}
public void setJdbi(Jdbi jdbi) {
this.jdbi = jdbi;
}
private Class getType() {
return type;
}
public void setType(Class type) {
this.type = type;
}
@Override
public void afterPropertiesSet() {
//noinspection unchecked
object = getJdbi().onDemand(getType());
}
@Override
public Object getObject() {
return object;
}
@Override
public Class> getObjectType() {
return getType();
}
@Override
public boolean isSingleton() {
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy