You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.2 KiB
Java
40 lines
1.2 KiB
Java
package go.kr.project.vmis.config;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
/**
|
|
* 전역 상수 및 설정값을 관리하는 클래스
|
|
*
|
|
* <p>이 클래스는 애플리케이션 전반에서 사용되는 전역 설정값을 제공합니다.
|
|
* Spring의 @Value를 통해 application.yml의 설정값을 주입받아 사용합니다.</p>
|
|
*/
|
|
@Component
|
|
public class Globals {
|
|
|
|
/**
|
|
* 데이터베이스 타입 (예: mariadb, oracle, mysql 등)
|
|
*
|
|
* <p>MyBatis Mapper XML 파일 선택 시 사용됩니다.
|
|
* mapper-locations: classpath:mybatis/mapper/**\/*_${Globals.DbType}.xml</p>
|
|
*
|
|
* <p>예시:
|
|
* <ul>
|
|
* <li>DbType = "mariadb" → user_mariadb.xml 매핑</li>
|
|
* <li>DbType = "oracle" → user_oracle.xml 매핑</li>
|
|
* </ul>
|
|
* </p>
|
|
*/
|
|
public static String DbType;
|
|
|
|
/**
|
|
* application.yml에서 Globals.DbType 값을 주입합니다.
|
|
*
|
|
* @param dbType 데이터베이스 타입 (기본값: mariadb)
|
|
*/
|
|
@Value("${Globals.DbType:mariadb}")
|
|
public void setDbType(String dbType) {
|
|
Globals.DbType = dbType;
|
|
}
|
|
}
|