From 8483115648add2c2db89456500c494e206266be4 Mon Sep 17 00:00:00 2001 From: bluejick Date: Wed, 17 Sep 2025 21:25:53 +0900 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20application.properties=EB=A5=BC=20a?= =?UTF-8?q?pplication.yml=EB=A1=9C=20=EB=B3=80=ED=99=98=20=EB=B0=8F=20?= =?UTF-8?q?=EA=B5=AD=EC=A0=9C=ED=99=94=20=EC=A3=BC=EC=84=9D=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20-=20application.properties=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=20-=20application.yml=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=20=EC=8B=A0=EA=B7=9C=20=EC=83=9D=EC=84=B1=20(=ED=95=9C?= =?UTF-8?q?=EA=B8=80-=EC=98=81=EB=AC=B8=20=EB=B3=91=ED=96=89=20=EC=A3=BC?= =?UTF-8?q?=EC=84=9D)=20-=20UTF-8=20=EC=9D=B8=EC=BD=94=EB=94=A9=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EB=8B=A4=EA=B5=AD=EC=96=B4=20=EC=99=84=EB=B2=BD=20?= =?UTF-8?q?=EC=A7=80=EC=9B=90=20-=20README.md=EC=97=90=20YAML=20=EB=B3=80?= =?UTF-8?q?=ED=99=98=20=EB=82=B4=EC=9A=A9=20=EB=B0=98=EC=98=81=20-=20Sprin?= =?UTF-8?q?g=20Boot=20=EA=B6=8C=EC=9E=A5=20YAML=20=ED=98=95=EC=8B=9D=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit feat: Convert application.properties to application.yml and add internationalization comments - Delete application.properties file - Create new application.yml file (Korean-English bilingual comments) - Perfect multilingual support with UTF-8 encoding - Reflect YAML conversion content in README.md - Apply Spring Boot recommended YAML format --- README.md | 61 ++++++++++++++++++++++- src/main/resources/application.properties | 9 ---- src/main/resources/application.yml | 25 ++++++++++ 3 files changed, 84 insertions(+), 11 deletions(-) delete mode 100644 src/main/resources/application.properties create mode 100644 src/main/resources/application.yml diff --git a/README.md b/README.md index e395271..84dc603 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ __프로젝트 우클릭 > Run As > Spring Boot App__ 을 통해 구동한다. ### 구동 후 확인 구동 후, 브라우저에서 `http://localhost:포트번호/` 로 확인이 가능하다. -초기 포트번호는 8080이며 `src/main/resources/application.properties` 파일의 `server.port` 항목에서 변경 가능하다. +초기 포트번호는 8080이며 `src/main/resources/application.yml` 파일의 `server.port` 항목에서 변경 가능하다. ## 참조 화면 @@ -51,4 +51,61 @@ __프로젝트 우클릭 > Run As > Spring Boot App__ 을 통해 구동한다. #### 2) context-\*.xml -> @Configuration 변환 -#### 3) properties 변환(예정) boot 지원 +#### 3) properties 삭제 -> yaml 파일로 변환 + +--- + +# eGovFrame Boot-based Simple Board + +![java](https://img.shields.io/badge/java-007396?style=for-the-badge&logo=JAVA&logoColor=white) +![javascript](https://img.shields.io/badge/javascript-F7DF1E?style=for-the-badge&logo=javascript&logoColor=black) +![Spring_boot](https://img.shields.io/badge/Spring_Boot-F2F4F9?style=for-the-badge&logo=spring-boot) +![maven](https://img.shields.io/badge/Maven-C71A36?style=for-the-badge&logo=apache-maven&logoColor=white) +![workflow](https://github.com/eGovFramework/egovframe-boot-sample-java-config/actions/workflows/maven.yml/badge.svg) + +※ This project is a basic board example source code based on Spring Boot. + +## Environment Setup + +The environment program information used in the project is as follows. +| Program Name | Version | +| :--------- | :------ | +| java | 1.8 or higher | +| maven | 3.8.4 ~ 3.8.8 | + +## Project Execution + +### CLI Execution Method + +```bash +mvn spring-boot:run +``` + +### IDE Execution Method + +Execute through __Project Right Click > Run As > Spring Boot App__. + +### Verification After Execution + +After execution, you can check at `http://localhost:port number/` in the browser. +The initial port number is 8080, and it can be changed in the `server.port` item of the `src/main/resources/application.yml` file. + +## Reference Screens + +### List Screen + +![4th_new_web4](https://github.com/user-attachments/assets/199c6964-1aa1-42bc-a3d2-0234d037057a) + +### Post Registration Screen + +![4th_new_web5](https://github.com/user-attachments/assets/91c1b668-cb59-45ea-8b13-0e3f34ea9078) + +## Changes + +### 1. [Java Config Conversion](./Docs/java-config-convert.md) + +#### 1) Web.xml -> WebApplicationInitializer Implementation Conversion + +#### 2) context-\*.xml -> @Configuration Conversion + +#### 3) properties Deletion -> yaml File Conversion diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties deleted file mode 100644 index 3b59fc5..0000000 --- a/src/main/resources/application.properties +++ /dev/null @@ -1,9 +0,0 @@ -server.port=8080 - -# \uc218\ub3d9 Bean\uc774 \uc790\ub3d9 Bean\uc744 \uc624\ubc84\ub77c\uc774\ub529\ud558\uac8c \uc124\uc815 -spring.main.allow-bean-definition-overriding=true - -# open-in-view(\ud639\uc740 Open-Session-In-View(OSIV)) -# true(\uae30\ubcf8\uac12) : \uc0ac\uc6a9\uc790\uc5d0\uac8c \uc751\ub2f5 \ub610\ub294 view\uac00 \ub80c\ub354\ub9c1\ub420 \ub54c\uae4c\uc9c0 \uc601\uc18d\uc131 \ucee8\ud14d\uc2a4\ud2b8 \uc720\uc9c0 -# false : \ud2b8\ub79c\uc81d\uc158\uc774 \uc885\ub8cc\ub420 \ub54c \uc601\uc18d\uc131 \ucee8\ud14d\uc2a4\ud2b8 \uc885\ub8cc -spring.jpa.open-in-view=false diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..c98e02e --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,25 @@ +# 전자정부 표준프레임워크 Spring Boot 설정 +# eGovFrame Spring Boot Configuration + +server: + # 서버 포트 설정 + # Server port configuration + port: 8080 + +spring: + main: + # 수동 Bean이 자동 Bean을 오버라이딩하게 설정 + # 개발 시 커스텀 Bean이 기본 Bean을 대체할 수 있도록 허용 + # Allow manual beans to override automatic beans + # Enables custom beans to replace default beans during development + allow-bean-definition-overriding: true + + jpa: + # Open-in-View 패턴 설정 (OSIV) + # true(기본값): 사용자에게 응답 또는 view가 렌더링될 때까지 영속성 컨텍스트 유지 + # false: 트랜잭션이 종료될 때 영속성 컨텍스트 종료 (성능상 권장) + # + # Open-in-View pattern configuration (OSIV) + # true(default): Keep persistence context until response or view rendering to user + # false: Close persistence context when transaction ends (recommended for performance) + open-in-view: false From 537b22382ef284a3ecd9b075a768b4d36b2f6900 Mon Sep 17 00:00:00 2001 From: bluejick Date: Wed, 17 Sep 2025 22:52:01 +0900 Subject: [PATCH 2/4] =?UTF-8?q?feat:=20=EC=A0=84=EC=9E=90=EC=A0=95?= =?UTF-8?q?=EB=B6=80=20=ED=94=84=EB=A0=88=EC=9E=84=EC=9B=8C=ED=81=AC=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=ED=8D=BC=ED=8B=B0=EB=A5=BC=20YAML=20?= =?UTF-8?q?=EC=97=B0=EB=8F=99=20=EB=B0=8F=20=EC=9E=90=EB=8F=99=ED=99=94=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=20-=20application.yml=EC=97=90=20egov=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=ED=8D=BC=ED=8B=B0=20=EC=84=B9=EC=85=98=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20(=ED=95=9C=EA=B8=80-=EC=98=81=EB=AC=B8=20?= =?UTF-8?q?=EB=B3=91=ED=96=89=20=EC=A3=BC=EC=84=9D)=20-=20EgovConfigProper?= =?UTF-8?q?ties.java=EB=A5=BC=20=EC=9E=90=EB=8F=99=ED=99=94=20=EB=B0=A9?= =?UTF-8?q?=EC=8B=9D=EC=9C=BC=EB=A1=9C=20=EA=B0=9C=EC=84=A0=20-=20Apache?= =?UTF-8?q?=20Commons=20Text=20CaseUtils=EB=A5=BC=20=ED=99=9C=EC=9A=A9?= =?UTF-8?q?=ED=95=9C=20kebab-case=20=E2=86=92=20camelCase=20=EC=9E=90?= =?UTF-8?q?=EB=8F=99=20=EB=B3=80=ED=99=98=20-=20YAML=EC=97=90=20=ED=94=84?= =?UTF-8?q?=EB=A1=9C=ED=8D=BC=ED=8B=B0=EB=A7=8C=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=ED=95=98=EB=A9=B4=20Java=20=EC=BD=94=EB=93=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=EC=97=86=EC=9D=B4=20=EC=9E=90=EB=8F=99=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=20-=20context-properties-convert.md=20=EB=AC=B8?= =?UTF-8?q?=EC=84=9C=EB=A5=BC=20=EC=9E=90=EB=8F=99=ED=99=94=20=EB=B0=A9?= =?UTF-8?q?=EC=8B=9D=EC=9C=BC=EB=A1=9C=20=EC=97=85=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit feat: Implement YAML integration and automation for eGovFrame properties - Add egov properties section to application.yml with bilingual comments - Improve EgovConfigProperties.java with automated approach - Implement automatic kebab-case → camelCase conversion using Apache Commons Text CaseUtils - Enable automatic property registration by only adding properties to YAML - Update context-properties-convert.md documentation with automation approach --- Docs/context-properties-convert.md | 105 +++++++++++++++--- .../example/config/EgovConfigProperties.java | 54 ++++++++- src/main/resources/application.yml | 21 ++++ 3 files changed, 159 insertions(+), 21 deletions(-) diff --git a/Docs/context-properties-convert.md b/Docs/context-properties-convert.md index 2262063..8b8c2c3 100644 --- a/Docs/context-properties-convert.md +++ b/Docs/context-properties-convert.md @@ -1,10 +1,10 @@ -# context-properties.xml 설정 변환 +# context-properties.xml 설정 변환 > 프로퍼티 정보 설정 +프로젝트 내에서 사용할 EgovPropertyService에 값을 등록하는 예제이다. - -프로젝트 내에서 사용할 EgovPropertyService에 값을 등록 하는 예제이다. +## XML 설정 (기존) @@ -22,21 +22,90 @@ ``` - +## Java Config 설정 (자동화된 YAML 연동 방식) + + + +```yaml +# 전자정부 프레임워크 프로퍼티 설정 +# eGovFrame Properties Configuration +# +# 주의: egov.* 프로퍼티는 자동으로 camelCase로 변환됩니다 +# Note: egov.* properties are automatically converted to camelCase +# 예시: egov.page-unit → pageUnit, egov.file-upload-size → fileUploadSize +# Example: egov.page-unit → pageUnit, egov.file-upload-size → fileUploadSize +egov: + # 페이징 설정 + # Pagination settings + page-unit: 10 + page-size: 10 + + # 파일 업로드 설정 (예시) + # File upload settings (example) + posbl-atch-file-size: 5242880 + globals-file-store-path: "/user/file/sht/" + globals-added-options: false +``` + + ```java -@Bean(destroyMethod = "destroy") -public EgovPropertyServiceImpl propertiesService() { - EgovPropertyServiceImpl egovPropertyServiceImpl = new EgovPropertyServiceImpl(); - - Map properties = new HashMap(); - properties.put("pageUnit", "10"); - properties.put("pageSize", "10"); - properties.put("posblAtchFileSize", "5242880"); - properties.put("Globals.fileStorePath", "/user/file/sht/"); - properties.put("Globals.addedOptions", "false"); - - egovPropertyServiceImpl.setProperties(properties); - return egovPropertyServiceImpl; +@Configuration +public class EgovConfigProperties { + + @Autowired + private Environment environment; + + @Bean(destroyMethod = "destroy") + public EgovPropertyServiceImpl propertiesService() { + EgovPropertyServiceImpl egovPropertyServiceImpl = new EgovPropertyServiceImpl(); + Map properties = new HashMap<>(); + + // 모든 프로퍼티 소스에서 egov.* 프로퍼티를 찾아서 자동 변환 + // Find egov.* properties from all property sources and convert automatically + MutablePropertySources propertySources = ((AbstractEnvironment) environment).getPropertySources(); + + for (PropertySource propertySource : propertySources) { + if (propertySource instanceof EnumerablePropertySource) { + String[] propertyNames = ((EnumerablePropertySource) propertySource).getPropertyNames(); + + for (String propertyName : propertyNames) { + if (propertyName.startsWith("egov.")) { + String value = environment.getProperty(propertyName); + + // egov. 접두사 제거 후 kebab-case를 camelCase로 변환 + // Remove egov. prefix and convert kebab-case to camelCase + String key = propertyName.substring(5); // "egov." 제거 / Remove "egov." + String camelCaseKey = CaseUtils.toCamelCase(key, false, '-'); + + properties.put(camelCaseKey, value); + } + } + } + } + + egovPropertyServiceImpl.setProperties(properties); + return egovPropertyServiceImpl; + } } -``` \ No newline at end of file +``` + +## 자동 변환 예시 + +| YAML 설정 (kebab-case) | Java 프로퍼티 (camelCase) | 설명 | +|------------------------|---------------------------|------| +| `egov.page-unit` | `pageUnit` | 페이지당 항목 수 | +| `egov.page-size` | `pageSize` | 페이지 크기 | +| `egov.posbl-atch-file-size` | `posblAtchFileSize` | 첨부파일 최대 크기 | +| `egov.globals-file-store-path` | `globalsFileStorePath` | 파일 저장 경로 | +| `egov.new-awesome-feature` | `newAwesomeFeature` | 새 기능 (자동 추가) | + +## 개선 효과 + +1. **완전 자동화**: YAML에 프로퍼티만 추가하면 Java 코드 수정 없이 자동 등록 +2. **네이밍 컨벤션**: YAML은 kebab-case, Java는 camelCase 자동 변환 +3. **확장성**: 새로운 프로퍼티 추가 시 개발자 개입 불필요 +4. **중앙 집중 관리**: 모든 설정값이 application.yml에서 관리 +5. **환경별 설정**: 개발/운영 환경별로 다른 설정 파일 사용 가능 +6. **국제화**: 한글-영문 병행 주석으로 글로벌 개발자 지원 +7. **Apache Commons Text 활용**: 검증된 라이브러리로 안정적인 변환 diff --git a/src/main/java/egovframework/example/config/EgovConfigProperties.java b/src/main/java/egovframework/example/config/EgovConfigProperties.java index e0b22ae..7f5179f 100644 --- a/src/main/java/egovframework/example/config/EgovConfigProperties.java +++ b/src/main/java/egovframework/example/config/EgovConfigProperties.java @@ -1,22 +1,70 @@ package egovframework.example.config; +import org.apache.commons.text.CaseUtils; import org.egovframe.rte.fdl.property.impl.EgovPropertyServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.AbstractEnvironment; +import org.springframework.core.env.EnumerablePropertySource; +import org.springframework.core.env.Environment; +import org.springframework.core.env.MutablePropertySources; +import org.springframework.core.env.PropertySource; import java.util.HashMap; import java.util.Map; +/** + * 전자정부 프레임워크 프로퍼티 서비스 설정 + * eGovFrame Property Service Configuration + * + * @author eGovFrame Development Team + * @since 2025.09.17 + * @version 4.3.1 + */ @Configuration public class EgovConfigProperties { + @Autowired + private Environment environment; + + /** + * 전자정부 프레임워크 프로퍼티 서비스 빈 생성 + * YAML 설정 파일에서 egov.* 프로퍼티를 자동으로 읽어와 camelCase로 변환하여 등록 + * - + * Create eGovFrame property service bean + * Automatically read egov.* properties from YAML configuration and convert to camelCase + * + * @return EgovPropertyServiceImpl 프로퍼티 서비스 구현체 / Property service implementation + */ @Bean(destroyMethod="destroy") public EgovPropertyServiceImpl propertiesService() { + EgovPropertyServiceImpl egovPropertyServiceImpl = new EgovPropertyServiceImpl(); Map properties = new HashMap<>(); - properties.put("pageUnit", "10"); - properties.put("pageSize", "10"); + + // 모든 프로퍼티 소스에서 egov.* 프로퍼티를 찾아서 자동 변환 + // Find egov.* properties from all property sources and convert automatically + MutablePropertySources propertySources = ((AbstractEnvironment) environment).getPropertySources(); + + for (PropertySource propertySource : propertySources) { + if (propertySource instanceof EnumerablePropertySource) { + String[] propertyNames = ((EnumerablePropertySource) propertySource).getPropertyNames(); + + for (String propertyName : propertyNames) { + if (propertyName.startsWith("egov.")) { + String value = environment.getProperty(propertyName); + + // egov. 접두사 제거 후 kebab-case를 camelCase로 변환 + // Remove egov. prefix and convert kebab-case to camelCase + String key = propertyName.substring(5); // "egov." 제거 / Remove "egov." + String camelCaseKey = CaseUtils.toCamelCase(key, false, '-'); + + properties.put(camelCaseKey, value); + } + } + } + } - EgovPropertyServiceImpl egovPropertyServiceImpl = new EgovPropertyServiceImpl(); egovPropertyServiceImpl.setProperties(properties); return egovPropertyServiceImpl; } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index c98e02e..5efeac8 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -23,3 +23,24 @@ spring: # true(default): Keep persistence context until response or view rendering to user # false: Close persistence context when transaction ends (recommended for performance) open-in-view: false + +# 전자정부 프레임워크 프로퍼티 설정 +# 주의: egov.* 프로퍼티는 자동으로 camelCase로 변환됩니다 +# 예시: egov.page-unit → pageUnit, egov.file-upload-size → fileUploadSize +# 활용 : propertiesService.getInt("pageUnit") +# +# eGovFrame Properties Configuration +# Note: egov.* properties are automatically converted to camelCase +# Example: egov.page-unit → pageUnit, egov.file-upload-size → fileUploadSize +# Usage : propertiesService.getInt("pageUnit") +egov: + # 페이징 설정 + # Pagination settings + page-unit: 15 + page-size: 5 + + # 파일 업로드 설정 + # File upload settings + posbl-atch-file-size: 5242880 + globals-file-store-path: "/user/file/sht/" + globals-added-options: false \ No newline at end of file From 98327c6ef9345d625e898a247d47893f0b5d1436 Mon Sep 17 00:00:00 2001 From: bluejick Date: Thu, 18 Sep 2025 01:16:22 +0900 Subject: [PATCH 3/4] =?UTF-8?q?feat:=20=EC=A0=84=EC=9E=90=EC=A0=95?= =?UTF-8?q?=EB=B6=80=20=ED=94=84=EB=A0=88=EC=9E=84=EC=9B=8C=ED=81=AC=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=ED=8D=BC=ED=8B=B0=EB=A5=BC=20Globals=20?= =?UTF-8?q?=EB=B0=A9=EC=8B=9D=EC=9C=BC=EB=A1=9C=20=EA=B0=9C=EC=84=A0=20?= =?UTF-8?q?=EB=B0=8F=20=EB=8B=A4=EC=A4=91=20DB=20=EC=A7=80=EC=9B=90=20-=20?= =?UTF-8?q?application.yml=EC=9D=84=20=EC=8B=AC=ED=94=8C=EB=B0=B1=EC=97=94?= =?UTF-8?q?=EB=93=9C=20=ED=98=B8=ED=99=98=20Globals.*=20=EA=B5=AC=EC=A1=B0?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20-=20EgovConfigProperties.java?= =?UTF-8?q?=EC=97=90=EC=84=9C=20Globals.*=20=ED=94=84=EB=A1=9C=ED=8D=BC?= =?UTF-8?q?=ED=8B=B0=20=EC=9E=90=EB=8F=99=20=EB=B3=80=ED=99=98=20(kebab-ca?= =?UTF-8?q?se=20=E2=86=92=20PascalCase)=20-=20EgovConfigDatasource.java?= =?UTF-8?q?=EC=97=90=20MySQL,=20Oracle=20=EB=8F=99=EC=A0=81=20=EC=A7=80?= =?UTF-8?q?=EC=9B=90=20=EC=B6=94=EA=B0=80=20-=20Apache=20Commons=20Text=20?= =?UTF-8?q?CaseUtils=20=ED=99=9C=EC=9A=A9=ED=95=9C=20DB=20=ED=83=80?= =?UTF-8?q?=EC=9E=85=EB=B3=84=20=ED=94=84=EB=A1=9C=ED=8D=BC=ED=8B=B0=20?= =?UTF-8?q?=EC=9E=90=EB=8F=99=20=EB=A7=A4=ED=95=91=20-=20=EA=B8=B0?= =?UTF-8?q?=EC=A1=B4=20propertiesService=20=EC=82=AC=EC=9A=A9=20=EB=B6=80?= =?UTF-8?q?=EB=B6=84=EC=9D=84=20Globals.*=20=ED=82=A4=EB=A1=9C=20=EC=97=85?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit feat: Improve eGovFrame properties to Globals approach and add multi-database support - Change application.yml to simple-backend compatible Globals.* structure - Implement automatic Globals.* property conversion in EgovConfigProperties.java (kebab-case → PascalCase) - Add dynamic MySQL and Oracle support in EgovConfigDatasource.java - Utilize Apache Commons Text CaseUtils for database-type-specific property mapping - Update existing propertiesService usage to Globals.* keys --- Docs/context-datasource-convert.md | 235 +++++++++++++----- Docs/context-properties-convert.md | 127 +++++++--- pom.xml | 17 ++ .../example/config/EgovConfigDatasource.java | 87 ++++++- .../example/config/EgovConfigProperties.java | 53 +++- .../sample/web/EgovSampleController.java | 4 +- src/main/resources/application.yml | 49 +++- 7 files changed, 447 insertions(+), 125 deletions(-) diff --git a/Docs/context-datasource-convert.md b/Docs/context-datasource-convert.md index cd172c0..7cd6e13 100644 --- a/Docs/context-datasource-convert.md +++ b/Docs/context-datasource-convert.md @@ -1,36 +1,20 @@ -# context-datasource.xml 설정 변환 +# context-datasource.xml 설정 변환 > 데이터 소스관련 설정 사항들 다루고 있음 +## XML 설정 (기존) - -내장 DB 사용시 +### 내장 DB 사용시 ```xml - + ``` - - -```java -private DataSource dataSourceHSQL() { - return new EmbeddedDatabaseBuilder() - .setType(EmbeddedDatabaseType.HSQL) - .setScriptEncoding("UTF8") - .addScript("classpath:/db/shtdb.sql") - // .addScript("classpath:/otherpath/other.sql") - .build(); -} -``` - - - - -다른 DB 사용시 +### 다른 DB 사용시 @@ -50,54 +34,179 @@ private DataSource dataSourceHSQL() { +``` - - - - - - - +## Java Config 설정 (Globals 자동화 방식) + + + +```yaml +# 전자정부 프레임워크 글로벌 설정 (심플백엔드 호환) +# 주의: Globals.* 프로퍼티는 자동으로 PascalCase로 변환됩니다 +# 예시: Globals.db-type → Globals.DbType, Globals.mysql.driver-class-name → Globals.Mysql.DriverClassName +# 활용: propertiesService.getString("Globals.DbType") +# +# eGovFrame Global Configuration (Simple-backend compatible) +# Note: Globals.* properties are automatically converted to PascalCase +# Example: Globals.db-type → Globals.DbType, Globals.mysql.driver-class-name → Globals.Mysql.DriverClassName +# Usage: propertiesService.getString("Globals.DbType") +Globals: + # 데이터베이스 설정 + # Database settings + db-type: "mysql" # hsql, mysql, oracle + + # MySQL 설정 + # MySQL configuration + mysql: + driver-class-name: "com.mysql.cj.jdbc.Driver" + url: "jdbc:mysql://127.0.0.1:3306/egovframe" + user-name: "egovframe" + password: "egovframe" + + # Oracle 설정 + # Oracle configuration + oracle: + driver-class-name: "oracle.jdbc.driver.OracleDriver" + url: "jdbc:oracle:thin:@127.0.0.1:1521:XE" + user-name: "egovframe" + password: "egovframe" +``` - - - - - - - + - - - - - - - +```java +@Configuration +public class EgovConfigDatasource { + + @Autowired + private EgovPropertyService propertiesService; + + private String className; + private String url; + private String username; + private String password; + + /** + * 데이터소스 빈 생성 + * 프로퍼티 서비스에서 설정값을 읽어와 DB 타입에 따라 적절한 데이터소스 구성 + * @return DataSource 데이터소스 / DataSource instance + */ + @Bean(name="dataSource") + public DataSource dataSource() { + // 프로퍼티 서비스에서 DB 설정값 읽기 + // Read database configuration from property service + String dbType = propertiesService.getString("Globals.DbType", "hsql").toLowerCase(); + String dbTypeCapitalized = CaseUtils.toCamelCase(dbType, true); + this.className = propertiesService.getString("Globals." + dbTypeCapitalized + ".DriverClassName", "com.mysql.cj.jdbc.Driver"); + this.url = propertiesService.getString("Globals." + dbTypeCapitalized + ".Url", "jdbc:mysql://localhost:3306/egovframe"); + this.username = propertiesService.getString("Globals." + dbTypeCapitalized + ".UserName", "egovframe"); + this.password = propertiesService.getString("Globals." + dbTypeCapitalized + ".Password", "egovframe"); + + // DB 타입에 따른 데이터소스 생성 + // Create datasource based on database type + switch (dbType) { + case "mysql": + case "oracle": + return basicDataSource(dbType); + case "hsql": + default: + return embeddedDataSource(); + } + } + + /** + * 내장 데이터베이스 생성 (HSQL) + * @return DataSource 내장 데이터소스 / Embedded DataSource + */ + private DataSource embeddedDataSource() { + String scriptLocation = propertiesService.getString("Globals.Hsql.ScriptLocation", "classpath:/db/sampledb.sql"); + EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder(); + return builder + .setType(EmbeddedDatabaseType.HSQL) + .addScript(scriptLocation) + .build(); + } + + /** + * 외부 데이터베이스 생성 (MySQL, Oracle) + * @param dbType 데이터베이스 타입 / Database type + * @return DataSource 외부 데이터소스 / External DataSource + */ + private DataSource basicDataSource(String dbType) { + BasicDataSource dataSource = new BasicDataSource(); + dataSource.setDriverClassName(this.className); + dataSource.setUrl(this.url); + dataSource.setUsername(this.username); + dataSource.setPassword(this.password); + + // 커넥션 풀 설정 + // Connection pool settings + dataSource.setInitialSize(5); + dataSource.setMaxTotal(20); + dataSource.setMaxIdle(10); + dataSource.setMinIdle(5); + return dataSource; + } +} ``` - +## 동적 프로퍼티 매핑 -```java +### DB 타입별 자동 프로퍼티 선택 -@PostConstruct -void init() { - dbType = env.getProperty("Globals.DbType"); - //Exception 처리 필요 - className = env.getProperty("Globals." + dbType + ".DriverClassName"); - url = env.getProperty("Globals." + dbType + ".Url"); - userName = env.getProperty("Globals." + dbType + ".UserName"); - password = env.getProperty("Globals." + dbType + ".Password"); -} +| DB 타입 | YAML 설정 | Java 프로퍼티 키 | +|---------|-----------|------------------| +| mysql | `Globals.mysql.driver-class-name` | `Globals.Mysql.DriverClassName` | +| mysql | `Globals.mysql.url` | `Globals.Mysql.Url` | +| oracle | `Globals.oracle.driver-class-name` | `Globals.Oracle.DriverClassName` | +| oracle | `Globals.oracle.url` | `Globals.Oracle.Url` | -...... +### 동작 방식 -private DataSource basicDataSource() { - BasicDataSource basicDataSource = new BasicDataSource(); - basicDataSource.setDriverClassName(className); - basicDataSource.setUrl(url); - basicDataSource.setUsername(userName); - basicDataSource.setPassword(password); - return basicDataSource; -} -``` \ No newline at end of file +1. **DB 타입 확인**: `Globals.DbType` 값 읽기 +2. **동적 키 생성**: `CaseUtils.toCamelCase(dbType, true)` 활용 +3. **프로퍼티 조회**: `Globals.{DbType}.{Property}` 형태로 자동 매핑 + +## 사용 예시 + +### HSQL (내장 DB) +```yaml +Globals: + db-type: "hsql" +``` +→ 내장 HSQL 데이터베이스 사용 + +### MySQL +```yaml +Globals: + db-type: "mysql" + mysql: + driver-class-name: "com.mysql.cj.jdbc.Driver" + url: "jdbc:mysql://localhost:3306/egovframe" + user-name: "egovframe" + password: "egovframe" +``` +→ MySQL 외부 데이터베이스 사용 + +### Oracle +```yaml +Globals: + db-type: "oracle" + oracle: + driver-class-name: "oracle.jdbc.driver.OracleDriver" + url: "jdbc:oracle:thin:@localhost:1521:XE" + user-name: "egovframe" + password: "egovframe" +``` +→ Oracle 외부 데이터베이스 사용 + +## 개선 효과 + +1. **심플백엔드 호환성**: Globals.* 구조로 기존 전자정부 프로젝트와 일관성 확보 +2. **동적 DB 지원**: DB 타입 변경만으로 자동 데이터소스 전환 +3. **프로퍼티 자동화**: YAML 설정만으로 DB 연결 정보 관리 +4. **커넥션 풀**: 외부 DB 사용 시 자동 커넥션 풀 설정 +5. **확장성**: 새로운 DB 타입 추가 시 YAML 설정만 추가 +6. **중앙 집중 관리**: 모든 DB 설정이 application.yml에서 관리 +7. **환경별 설정**: 개발/운영 환경별로 다른 DB 설정 가능 +8. **Docker 지원**: 컨테이너 환경에서의 DB 연동 최적화 diff --git a/Docs/context-properties-convert.md b/Docs/context-properties-convert.md index 8b8c2c3..16e1083 100644 --- a/Docs/context-properties-convert.md +++ b/Docs/context-properties-convert.md @@ -22,29 +22,51 @@ ``` -## Java Config 설정 (자동화된 YAML 연동 방식) +## Java Config 설정 (Globals 자동화 방식) ```yaml -# 전자정부 프레임워크 프로퍼티 설정 -# eGovFrame Properties Configuration -# -# 주의: egov.* 프로퍼티는 자동으로 camelCase로 변환됩니다 -# Note: egov.* properties are automatically converted to camelCase -# 예시: egov.page-unit → pageUnit, egov.file-upload-size → fileUploadSize -# Example: egov.page-unit → pageUnit, egov.file-upload-size → fileUploadSize -egov: +# 전자정부 프레임워크 글로벌 설정 (심플백엔드 호환) +# 주의: Globals.* 프로퍼티는 자동으로 PascalCase로 변환됩니다 +# 예시: Globals.page-unit → Globals.PageUnit, Globals.db-type → Globals.DbType +# 활용: propertiesService.getString("Globals.PageUnit") +# +# eGovFrame Global Configuration (Simple-backend compatible) +# Note: Globals.* properties are automatically converted to PascalCase +# Example: Globals.page-unit → Globals.PageUnit, Globals.db-type → Globals.DbType +# Usage: propertiesService.getString("Globals.PageUnit") +Globals: # 페이징 설정 # Pagination settings page-unit: 10 page-size: 10 - # 파일 업로드 설정 (예시) - # File upload settings (example) + # 파일 업로드 설정 + # File upload settings posbl-atch-file-size: 5242880 - globals-file-store-path: "/user/file/sht/" - globals-added-options: false + file-store-path: "./files" + added-options: false + + # 데이터베이스 설정 + # Database settings + db-type: "mysql" # hsql, mysql, oracle + + # MySQL 설정 + # MySQL configuration + mysql: + driver-class-name: "com.mysql.cj.jdbc.Driver" + url: "jdbc:mysql://127.0.0.1:3306/egovframe" + user-name: "egovframe" + password: "egovframe" + + # Oracle 설정 + # Oracle configuration + oracle: + driver-class-name: "oracle.jdbc.driver.OracleDriver" + url: "jdbc:oracle:thin:@127.0.0.1:1521:XE" + user-name: "egovframe" + password: "egovframe" ``` @@ -61,8 +83,8 @@ public class EgovConfigProperties { EgovPropertyServiceImpl egovPropertyServiceImpl = new EgovPropertyServiceImpl(); Map properties = new HashMap<>(); - // 모든 프로퍼티 소스에서 egov.* 프로퍼티를 찾아서 자동 변환 - // Find egov.* properties from all property sources and convert automatically + // 모든 프로퍼티 소스에서 Globals.* 프로퍼티를 찾아서 자동 변환 + // Find Globals.* properties from all property sources and convert automatically MutablePropertySources propertySources = ((AbstractEnvironment) environment).getPropertySources(); for (PropertySource propertySource : propertySources) { @@ -70,15 +92,10 @@ public class EgovConfigProperties { String[] propertyNames = ((EnumerablePropertySource) propertySource).getPropertyNames(); for (String propertyName : propertyNames) { - if (propertyName.startsWith("egov.")) { + if (propertyName.startsWith("Globals.")) { String value = environment.getProperty(propertyName); - - // egov. 접두사 제거 후 kebab-case를 camelCase로 변환 - // Remove egov. prefix and convert kebab-case to camelCase - String key = propertyName.substring(5); // "egov." 제거 / Remove "egov." - String camelCaseKey = CaseUtils.toCamelCase(key, false, '-'); - - properties.put(camelCaseKey, value); + String key = convertGlobalsProperty(propertyName); + properties.put(key, value); } } } @@ -87,25 +104,63 @@ public class EgovConfigProperties { egovPropertyServiceImpl.setProperties(properties); return egovPropertyServiceImpl; } + + // Globals.page-unit → Globals.PageUnit 변환 + // Globals.mysql.driver-class-name → Globals.Mysql.DriverClassName 변환 + private String convertGlobalsProperty(String propertyName) { + // CaseUtils.toCamelCase 활용한 변환 로직 + } } ``` ## 자동 변환 예시 -| YAML 설정 (kebab-case) | Java 프로퍼티 (camelCase) | 설명 | +| YAML 설정 (kebab-case) | Java 프로퍼티 (PascalCase) | 설명 | |------------------------|---------------------------|------| -| `egov.page-unit` | `pageUnit` | 페이지당 항목 수 | -| `egov.page-size` | `pageSize` | 페이지 크기 | -| `egov.posbl-atch-file-size` | `posblAtchFileSize` | 첨부파일 최대 크기 | -| `egov.globals-file-store-path` | `globalsFileStorePath` | 파일 저장 경로 | -| `egov.new-awesome-feature` | `newAwesomeFeature` | 새 기능 (자동 추가) | +| `Globals.page-unit` | `Globals.PageUnit` | 페이지당 항목 수 | +| `Globals.page-size` | `Globals.PageSize` | 페이지 크기 | +| `Globals.db-type` | `Globals.DbType` | 데이터베이스 타입 | +| `Globals.mysql.driver-class-name` | `Globals.Mysql.DriverClassName` | MySQL 드라이버 | +| `Globals.mysql.url` | `Globals.Mysql.Url` | MySQL 접속 URL | +| `Globals.oracle.user-name` | `Globals.Oracle.UserName` | Oracle 사용자명 | + +## 다중 데이터베이스 지원 + +### HSQL (내장 DB) +```yaml +Globals: + db-type: "hsql" +``` + +### MySQL +```yaml +Globals: + db-type: "mysql" + mysql: + driver-class-name: "com.mysql.cj.jdbc.Driver" + url: "jdbc:mysql://localhost:3306/egovframe" + user-name: "egovframe" + password: "egovframe" +``` + +### Oracle +```yaml +Globals: + db-type: "oracle" + oracle: + driver-class-name: "oracle.jdbc.driver.OracleDriver" + url: "jdbc:oracle:thin:@localhost:1521:XE" + user-name: "egovframe" + password: "egovframe" +``` ## 개선 효과 -1. **완전 자동화**: YAML에 프로퍼티만 추가하면 Java 코드 수정 없이 자동 등록 -2. **네이밍 컨벤션**: YAML은 kebab-case, Java는 camelCase 자동 변환 -3. **확장성**: 새로운 프로퍼티 추가 시 개발자 개입 불필요 -4. **중앙 집중 관리**: 모든 설정값이 application.yml에서 관리 -5. **환경별 설정**: 개발/운영 환경별로 다른 설정 파일 사용 가능 -6. **국제화**: 한글-영문 병행 주석으로 글로벌 개발자 지원 -7. **Apache Commons Text 활용**: 검증된 라이브러리로 안정적인 변환 +1. **심플백엔드 호환성**: Globals.* 구조로 기존 전자정부 프로젝트와 일관성 확보 +2. **완전 자동화**: YAML에 프로퍼티만 추가하면 Java 코드 수정 없이 자동 등록 +3. **다중 DB 지원**: DB 타입에 따른 동적 데이터소스 생성 +4. **네이밍 컨벤션**: YAML은 kebab-case, Java는 PascalCase 자동 변환 +5. **중앙 집중 관리**: 모든 설정값이 application.yml에서 관리 +6. **환경별 설정**: 개발/운영 환경별로 다른 설정 파일 사용 가능 +7. **국제화**: 한글-영문 병행 주석으로 글로벌 개발자 지원 +8. **Apache Commons Text 활용**: 검증된 라이브러리로 안정적인 변환 diff --git a/pom.xml b/pom.xml index 1d92a99..349ec2b 100644 --- a/pom.xml +++ b/pom.xml @@ -111,6 +111,23 @@ 2.7.3 jdk8 + + mysql + mysql-connector-java + 8.0.33 + + + + org.apache.commons + commons-dbcp2 + 2.12.0 + org.projectlombok lombok diff --git a/src/main/java/egovframework/example/config/EgovConfigDatasource.java b/src/main/java/egovframework/example/config/EgovConfigDatasource.java index 6dd7068..618a9fc 100644 --- a/src/main/java/egovframework/example/config/EgovConfigDatasource.java +++ b/src/main/java/egovframework/example/config/EgovConfigDatasource.java @@ -1,5 +1,9 @@ package egovframework.example.config; +import org.apache.commons.dbcp2.BasicDataSource; +import org.apache.commons.text.CaseUtils; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; @@ -7,13 +11,92 @@ import javax.sql.DataSource; +/** + * 전자정부 프레임워크 데이터소스 설정 + * eGovFrame DataSource Configuration + * + * @author eGovFrame Development Team + * @since 2025.09.17 + * @version 4.3.1 + */ @Configuration public class EgovConfigDatasource { + @Autowired + private EgovPropertyService propertiesService; + + private String className; + private String url; + private String username; + private String password; + + /** + * 데이터소스 빈 생성 + * 프로퍼티 서비스에서 설정값을 읽어와 DB 타입에 따라 적절한 데이터소스 구성 + * - + * Create DataSource bean + * Configure appropriate datasource based on database type from property service + * + * @return DataSource 데이터소스 / DataSource instance + */ @Bean(name="dataSource") public DataSource dataSource() { - EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder(); - return builder.setType(EmbeddedDatabaseType.HSQL).addScript("classpath:/db/sampledb.sql").build(); + // 프로퍼티 서비스에서 DB 설정값 읽기 + // Read database configuration from property service + String dbType = propertiesService.getString("Globals.DbType", "mysql").toLowerCase(); + String dbTypeCapitalized = CaseUtils.toCamelCase(dbType, true); + this.className = propertiesService.getString("Globals." + dbTypeCapitalized + ".DriverClassName", "com.mysql.cj.jdbc.Driver"); + this.url = propertiesService.getString("Globals." + dbTypeCapitalized + ".Url", "jdbc:mysql://localhost:3306/egovframe"); + this.username = propertiesService.getString("Globals." + dbTypeCapitalized + ".UserName", "sa"); + this.password = propertiesService.getString("Globals." + dbTypeCapitalized + ".Password", "egovframe"); + + // DB 타입에 따른 데이터소스 생성 + // Create datasource based on database type + switch (dbType) { + case "mysql": + case "oracle": + return basicDataSource(dbType); + case "hsql": + default: + return embeddedDataSource(); + } } + /** + * 내장 데이터베이스 생성 (HSQL) + * Create embedded database (HSQL) + * + * @return DataSource 내장 데이터소스 / Embedded DataSource + */ + private DataSource embeddedDataSource() { + String scriptLocation = propertiesService.getString("Globals.Hsql.ScriptLocation", "classpath:/db/sampledb.sql"); + EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder(); + return builder + .setType(EmbeddedDatabaseType.HSQL) + .addScript(scriptLocation) + .build(); + } + + /** + * 외부 데이터베이스 생성 (MySQL, Oracle) + * Create external database (MySQL, Oracle) + * + * @param dbType 데이터베이스 타입 / Database type + * @return DataSource 외부 데이터소스 / External DataSource + */ + private DataSource basicDataSource(String dbType) { + BasicDataSource dataSource = new BasicDataSource(); + dataSource.setDriverClassName(this.className); + dataSource.setUrl(this.url); + dataSource.setUsername(this.username); + dataSource.setPassword(this.password); + + // 커넥션 풀 설정 + // Connection pool settings + dataSource.setInitialSize(5); + dataSource.setMaxTotal(20); + dataSource.setMaxIdle(10); + dataSource.setMinIdle(5); + return dataSource; + } } diff --git a/src/main/java/egovframework/example/config/EgovConfigProperties.java b/src/main/java/egovframework/example/config/EgovConfigProperties.java index 7f5179f..17281dd 100644 --- a/src/main/java/egovframework/example/config/EgovConfigProperties.java +++ b/src/main/java/egovframework/example/config/EgovConfigProperties.java @@ -30,10 +30,10 @@ public class EgovConfigProperties { /** * 전자정부 프레임워크 프로퍼티 서비스 빈 생성 - * YAML 설정 파일에서 egov.* 프로퍼티를 자동으로 읽어와 camelCase로 변환하여 등록 + * YAML 설정 파일에서 Globals.* 프로퍼티를 자동으로 읽어와 PascalCase로 변환하여 등록 * - * Create eGovFrame property service bean - * Automatically read egov.* properties from YAML configuration and convert to camelCase + * Automatically read Globals.* properties from YAML configuration and convert to PascalCase * * @return EgovPropertyServiceImpl 프로퍼티 서비스 구현체 / Property service implementation */ @@ -42,8 +42,8 @@ public EgovPropertyServiceImpl propertiesService() { EgovPropertyServiceImpl egovPropertyServiceImpl = new EgovPropertyServiceImpl(); Map properties = new HashMap<>(); - // 모든 프로퍼티 소스에서 egov.* 프로퍼티를 찾아서 자동 변환 - // Find egov.* properties from all property sources and convert automatically + // 모든 프로퍼티 소스에서 Globals.* 프로퍼티를 찾아서 자동 변환 + // Find Globals.* properties from all property sources and convert automatically MutablePropertySources propertySources = ((AbstractEnvironment) environment).getPropertySources(); for (PropertySource propertySource : propertySources) { @@ -51,15 +51,14 @@ public EgovPropertyServiceImpl propertiesService() { String[] propertyNames = ((EnumerablePropertySource) propertySource).getPropertyNames(); for (String propertyName : propertyNames) { - if (propertyName.startsWith("egov.")) { + if (propertyName.startsWith("Globals.")) { String value = environment.getProperty(propertyName); - // egov. 접두사 제거 후 kebab-case를 camelCase로 변환 - // Remove egov. prefix and convert kebab-case to camelCase - String key = propertyName.substring(5); // "egov." 제거 / Remove "egov." - String camelCaseKey = CaseUtils.toCamelCase(key, false, '-'); + // Globals. 접두사 유지하고 나머지 부분을 kebab-case → PascalCase로 변환 + // Keep Globals. prefix and convert remaining part from kebab-case to PascalCase + String key = convertGlobalsProperty(propertyName); - properties.put(camelCaseKey, value); + properties.put(key, value); } } } @@ -69,4 +68,38 @@ public EgovPropertyServiceImpl propertiesService() { return egovPropertyServiceImpl; } + /** + * Globals 프로퍼티 키를 PascalCase로 변환 + * Convert Globals property key to PascalCase + * Example : Globals.page-unit → Globals.PageUnit + * Example : Globals.mysql.driver-class-name → Globals.Mysql.DriverClassName + * + * @param propertyName 원본 프로퍼티 이름 / Original property name + * @return String 변환된 프로퍼티 이름 / Converted property name + */ + private String convertGlobalsProperty(String propertyName) { + // Globals. 접두사 분리 + // Separate Globals. prefix + String withoutGlobals = propertyName.substring(8); // "Globals." 제거 + + // 점(.)으로 분할하여 각 부분을 PascalCase로 변환 + // Split by dot and convert each part to PascalCase + String[] parts = withoutGlobals.split("\\."); + StringBuilder result = new StringBuilder("Globals."); + + for (int i = 0; i < parts.length; i++) { + String part = parts[i]; + // kebab-case를 PascalCase로 변환 (첫글자 대문자) + // Convert kebab-case to PascalCase (first letter uppercase) + String pascalCase = CaseUtils.toCamelCase(part, true, '-'); + result.append(pascalCase); + + if (i < parts.length - 1) { + result.append("."); + } + } + + return result.toString(); + } + } diff --git a/src/main/java/egovframework/example/sample/web/EgovSampleController.java b/src/main/java/egovframework/example/sample/web/EgovSampleController.java index f07517a..648ae4d 100644 --- a/src/main/java/egovframework/example/sample/web/EgovSampleController.java +++ b/src/main/java/egovframework/example/sample/web/EgovSampleController.java @@ -33,8 +33,8 @@ public String search(@ModelAttribute SampleVO sampleVO, Model model) throws Exce @PostMapping("/sample/list") public String list(@ModelAttribute SampleVO sampleVO, Model model) throws Exception { - sampleVO.setPageUnit(propertiesService.getInt("pageUnit")); - sampleVO.setPageSize(propertiesService.getInt("pageSize")); + sampleVO.setPageUnit(propertiesService.getInt("Globals.PageUnit")); + sampleVO.setPageSize(propertiesService.getInt("Globals.PageSize")); // pagination setting PaginationInfo paginationInfo = new PaginationInfo(); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 5efeac8..4e83d3b 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -24,23 +24,48 @@ spring: # false: Close persistence context when transaction ends (recommended for performance) open-in-view: false -# 전자정부 프레임워크 프로퍼티 설정 -# 주의: egov.* 프로퍼티는 자동으로 camelCase로 변환됩니다 -# 예시: egov.page-unit → pageUnit, egov.file-upload-size → fileUploadSize -# 활용 : propertiesService.getInt("pageUnit") +# 전자정부 프레임워크 글로벌 설정 (심플백엔드 호환) +# 주의: Globals.* 프로퍼티는 자동으로 camelCase로 변환됩니다 +# 예시: Globals.page-unit → Globals.PageUnit, Globals.db-type → Globals.DbType +# 활용: propertiesService.getString("Globals.PageUnit") # -# eGovFrame Properties Configuration -# Note: egov.* properties are automatically converted to camelCase -# Example: egov.page-unit → pageUnit, egov.file-upload-size → fileUploadSize -# Usage : propertiesService.getInt("pageUnit") -egov: +# eGovFrame Global Configuration (Simple-backend compatible) +# Note: Globals.* properties are automatically converted to camelCase +# Example: Globals.page-unit → Globals.PageUnit, Globals.db-type → Globals.DbType +# Usage: propertiesService.getString("Globals.PageUnit") +Globals: # 페이징 설정 # Pagination settings page-unit: 15 page-size: 5 - + # 파일 업로드 설정 # File upload settings posbl-atch-file-size: 5242880 - globals-file-store-path: "/user/file/sht/" - globals-added-options: false \ No newline at end of file + file-store-path: "./files" + added-options: false + + # 데이터베이스 설정(hsql,mysql,oracle) + # Database settings + db-type: "mysql" + + # HSQL 설정 + # HSQL configuration + hsql: + script-location: "classpath:/db/sampledb.sql" + + # MySQL 설정 + # MySQL configuration + mysql: + driver-class-name: "com.mysql.cj.jdbc.Driver" + url: "jdbc:mysql://127.0.0.1:3306/egovframe" + user-name: "egovframe" + password: "egovframe" + + # Oracle 설정 + # Oracle configuration + oracle: + driver-class-name: "oracle.jdbc.driver.OracleDriver" + url: "jdbc:oracle:thin:@127.0.0.1:1521:sampledb" + user-name: "sa" + password: "" \ No newline at end of file From 03592c813e4d420a8c94f33ac13d2b241f5ad3c3 Mon Sep 17 00:00:00 2001 From: bluejick Date: Thu, 18 Sep 2025 21:29:35 +0900 Subject: [PATCH 4/4] =?UTF-8?q?pom.xml:=20-=20MySQL=20=EC=BB=A4=EB=84=A5?= =?UTF-8?q?=ED=84=B0=20=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8=20=20=20-=20my?= =?UTF-8?q?sql:mysql-connector-java:8.0.33=20=E2=86=92=20com.mysql:mysql-c?= =?UTF-8?q?onnector-j:8.4.0=20application.yml:=20-=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=95=20=EC=84=A4=EC=A0=95=20=EB=B3=80=EA=B2=BD=20=20=20-?= =?UTF-8?q?=20page-unit:=2015=20=E2=86=92=20page-unit:=2010=20=20=20-=20pa?= =?UTF-8?q?ge-size:=205=20=E2=86=92=20page-size:=2010=20-=20=EA=B8=B0?= =?UTF-8?q?=EB=B3=B8=20DB=20=ED=83=80=EC=9E=85=20=EB=B3=80=EA=B2=BD=20=20?= =?UTF-8?q?=20-=20db-type:=20"mysql"=20=E2=86=92=20"hsql"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 6 +++--- src/main/resources/application.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 349ec2b..aee1784 100644 --- a/pom.xml +++ b/pom.xml @@ -112,9 +112,9 @@ jdk8 - mysql - mysql-connector-java - 8.0.33 + com.mysql + mysql-connector-j + 8.4.0