39 lines
1.1 KiB
Java
39 lines
1.1 KiB
Java
package com.myoa.engineering.crawl.ppomppu.processor.configuration.properties;
|
|
|
|
import java.util.List;
|
|
import lombok.Getter;
|
|
import lombok.Setter;
|
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
@Component
|
|
@Setter
|
|
@Getter
|
|
@ConfigurationProperties(prefix = "hibernate")
|
|
public class HibernateProperties {
|
|
|
|
private List<HibernatePropertiesUnit> units;
|
|
|
|
@Getter
|
|
@Setter
|
|
public static class HibernatePropertiesUnit {
|
|
|
|
private String unitName;
|
|
private String dialect;
|
|
private String formatSql;
|
|
private String showSql;
|
|
private String hbm2ddlAuto;
|
|
private String disableAutoCommit;
|
|
|
|
}
|
|
|
|
public HibernatePropertiesUnit find(String unitName) {
|
|
return units.stream()
|
|
.filter(x -> x.getUnitName().equals(unitName))
|
|
.findFirst()
|
|
.orElseThrow(
|
|
() -> new IllegalArgumentException(this.getClass().getName() + ": unitName Not found. " + unitName));
|
|
}
|
|
|
|
}
|