-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
faet: 예제 프로젝트 및 함수 호출지점 정적 호출되게 추가 (#12)
- Loading branch information
Showing
5 changed files
with
47 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
### 예제 샘프 ### | ||
examples/ | ||
examples/spring-boot-kotlin/.idea/ | ||
|
||
|
||
|
||
### intellij ### | ||
*.iml | ||
.idea/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 28 additions & 1 deletion
29
examples/spring-boot-kotlin/src/main/kotlin/com/example/SpringBootKotlinApplication.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,38 @@ | ||
package com.example | ||
|
||
import com.jsoncsvbridge.factory.DefaultCsvCreatorFactory | ||
import org.springframework.boot.CommandLineRunner | ||
import org.springframework.boot.autoconfigure.SpringBootApplication | ||
import org.springframework.boot.runApplication | ||
import org.springframework.stereotype.Component | ||
import java.io.File | ||
|
||
@SpringBootApplication | ||
class SpringBootKotlinApplication | ||
|
||
fun main(args: Array<String>) { | ||
runApplication<SpringBootKotlinApplication>(*args) | ||
runApplication<SpringBootKotlinApplication>(*args) | ||
} | ||
|
||
@Component | ||
class CsvCreatorRunner() : CommandLineRunner { | ||
override fun run(vararg args: String) { | ||
val outputDir = File("csv_output").apply { mkdirs() } | ||
|
||
// JSON to CSV | ||
val jsonCreator = DefaultCsvCreatorFactory().createCsvCreator("json"); | ||
val jsonOutputPath = outputDir.resolve("output_json.csv").absolutePath | ||
|
||
// JSON to CSV | ||
val jsonInput = """ | ||
[ | ||
{"name": "Alice", "age": 30, "city": "New York"}, | ||
{"name": "Bob", "age": 25, "city": "Los Angeles"}, | ||
{"name": "Charlie", "age": 35, "city": "Chicago"} | ||
] | ||
""" | ||
|
||
jsonCreator.createCsv(jsonInput, jsonOutputPath) | ||
println("JSON to CSV conversion completed. File saved at: $jsonOutputPath") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters