直接使用Jackson 解析 Java 8 之後提供的 LocalDate 會發生,Java 8 date/time type not supported by default.
找到的解決方法.
Java 8 LocalDate With Jackson In Spring Boot
簡單的生活 愉快的生命
直接使用Jackson 解析 Java 8 之後提供的 LocalDate 會發生,Java 8 date/time type not supported by default.
找到的解決方法.
Java 8 LocalDate With Jackson In Spring Boot
最近開發一個小的 sprint boot app,有使用到 db and amqp. 原先研究的方法是使用 profile 方式來區隔相關的環境使用的 config properties. 但是,後面還是遇到疊加與重複撰寫的問題。
研究一陣子,使用 application profile + include 方式來處裡這樣多變化的組合.
首先, application profile 其觀念是,每一次 spring boot 還是會讀取 application.proerpties ,再去讀取設定的 application-{profile}.properties。只是後面的會蓋掉前面的設定,所以差異化要做在後面那些 profile. 因此在 application.properties 只包含最簡單的. 設定
application.properties
application.name=Gateweb Billing Agent
spring.profiles.active=local
application-local.properties
server.port=8181
spring.config.import=db-h2.properties,amqp-test.properties
application-test.properties
server.port=8080
spring.config.import=db-test.properties,amqp-test2.properties
將相關的資料 通通分開不同的設定檔.
db-h2.properties
spring.sql.init.mode=always
spring.sql.init.platform=h2
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.url=jdbc:h2:mem:db;DB_CLOSE_ON_EXIT=FALSE
spring.datasource.username=sa
spring.datasource.password=sa
##spring.datasource.schema=file:./test-data/schema-h2.sql
## Jpa Config
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=validate
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
spring.jpa.properties.hibernate.show_sql=false
spring.jpa.show-sql=false
amqp-test.properties
amqp.broker.host=cougar.rmq.cloudamqp.com
amqp.broker.vhost=xelvnewm
amqp.username=xelvnewm
amqp.password=SE6RHeTCJIf6E0KrxIOkDbdrEsYx82u2
db-test.properties
# Spring DB MySql
spring.sql.init.mode=never
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://test.mysql.database.azure.com:3306/test?useSSL=true&requireSSL=false
spring.datasource.username=test
spring.datasource.password=testpassword
# MySql Jpa Config
#spring.jpa.hibernate.ddl-auto=update
spring.jpa.database-platform=org.hibernate.dialect.MySQL8Dialect
spring.jpa.properties.hibernate.dialect.storage_engine=innodb
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
spring.jpa.properties.hibernate.show_sql=true
spring.jpa.show-sql=true
spring.jpa.open-in-view=false
amqp-test2.properties
amqp.broker.host=cougar.rmq.cloudamqp.com
amqp.broker.vhost=xelvnewmsdsd
amqp.username=xelvnewmsdsd
amqp.password=SE6RHeTCJIf6E
第三步
修改 build.gradle 新增 相關 bootRun task
tasks.register('bootRunLocal') {
dependsOn 'bootRun'
bootRun.systemProperty('spring.profiles.active', 'local')
}
tasks.register('bootRunTest') {
dependsOn 'bootRun'
bootRun.systemProperty('spring.profiles.active', 'test')
}
這陣子透過蝦皮賣掉一個3000元的東西,結果發現我只有收到 2819 元。 原本想說 蝦皮現在收我 6%手續費,算一算 不對呀 為何收我 181元。
今天收到蝦皮寄發的發票,發現發票上面列了兩個項目,一個是手續費 181元,一個是運費 45。
我才恍然大悟,手續費 181 元,因該是 買家付款 3045元,45元是運費。蝦皮把他算在我的收入,真是太賤了。 運費是買家付給貨運公司,跟賣家無關。又不是賣家免運費,所以先跟買家收錢。
最近開始把開發專案做不同module 的拆分,但在做測試時需要把相同的 test data 分享給不同的 module 使用。 一開始先選擇在每個module 底下維護自己的一套相關設定,當 module 多的時候發現這樣維護太累了.
接下來透過共用外部一個folder 來使用,所以先選擇會動的方式,使用絕對路徑方式來處理相關的 resource file.
最終版本,透過 gradle config 來達到這樣一個作法. 看了很多做法,也試試看是否可以使用. 最終使用 新增一行gradle script 來解決.
sourceSets.test.resources.srcDir file("$rootDir/$commonFolder")
android studio 無法從 markplace 安裝 lombok plugin.
找到下面這一篇,手動下載 plugin zip , 並放到 android studio/plugin 目錄.
但需要修正的地方, mac 安裝 android studio 位置不一樣. 要改在....
/Applications/Android Studio.app/Contents/plugins
參考資料
https://stackoverflow.com/questions/70900954/cannot-find-lombok-plugin-in-android-studio-2021-1-1-build-of-2022