This repository was archived by the owner on Feb 23, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed
samples/data-jdbc/src/main/java/com/example/data/jdbc
spring-native-configuration/src/main Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 1515 */
1616package com .example .data .jdbc ;
1717
18+ import javax .sql .DataSource ;
19+
20+ import com .zaxxer .hikari .HikariDataSource ;
21+
1822import org .springframework .boot .SpringApplication ;
1923import org .springframework .boot .autoconfigure .SpringBootApplication ;
24+ import org .springframework .boot .autoconfigure .jdbc .DataSourceProperties ;
25+ import org .springframework .context .annotation .Bean ;
2026import org .springframework .data .jdbc .repository .config .EnableJdbcAuditing ;
2127
2228@ SpringBootApplication
@@ -27,4 +33,10 @@ public static void main(String[] args) throws Exception {
2733 SpringApplication .run (JdbcApplication .class );
2834 Thread .currentThread ().join (); // To be able to measure memory consumption
2935 }
36+
37+ @ Bean
38+ // See https://github.com/spring-projects-experimental/spring-native/issues/1599
39+ public DataSource datasource (DataSourceProperties dataSourceProperties ) {
40+ return dataSourceProperties .initializeDataSourceBuilder ().type (HikariDataSource .class ).build ();
41+ }
3042}
Original file line number Diff line number Diff line change 1+ package com .zaxxer ;
2+
3+ import java .sql .Statement ;
4+
5+ import com .zaxxer .hikari .HikariDataSource ;
6+ import com .zaxxer .hikari .util .ConcurrentBag .IConcurrentBagEntry ;
7+
8+ import org .springframework .nativex .hint .NativeHint ;
9+ import org .springframework .nativex .hint .TypeAccess ;
10+ import org .springframework .nativex .hint .TypeHint ;
11+ import org .springframework .nativex .type .NativeConfiguration ;
12+
13+ @ NativeHint (trigger = HikariDataSource .class , types = {
14+ @ TypeHint (types = HikariDataSource .class , access = TypeAccess .PUBLIC_CONSTRUCTORS ),
15+ @ TypeHint (types = Statement [].class , access = {}),
16+ @ TypeHint (types = IConcurrentBagEntry [].class , access = {})
17+ })
18+ public class HikariHints implements NativeConfiguration {
19+ }
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ org.mariadb.MariaDbHints,\
1919com.mysql.cj.MySqlHints,\
2020com.wavefront.spring.actuate.WavefrontEndpointHints,\
2121com.wavefront.spring.actuate.WavefrontHints,\
22+ com.zaxxer.HikariHints,\
2223org.hamcrest.HamcrestHints,\
2324org.HdrHistogram.HdrHistogramHints,\
2425org.hibernate.HibernateHints,\
You can’t perform that action at this time.
0 commit comments