File tree Expand file tree Collapse file tree 7 files changed +122
-1
lines changed
SpringBootHikariDsqlExample
java/software/amazon/SpringBootHikariDsqlExample Expand file tree Collapse file tree 7 files changed +122
-1
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License").
5+ * You may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
17+ plugins {
18+ id(" org.springframework.boot" ) version " 2.7.0"
19+ id(" io.spring.dependency-management" ) version " 1.1.7"
20+ }
21+
22+ dependencies {
23+ implementation(" org.springframework.boot:spring-boot-starter-data-jdbc" )
24+ implementation(" org.springframework.boot:spring-boot-starter-web" )
25+ implementation(" org.postgresql:postgresql:42.7.7" )
26+ implementation(" software.amazon.awssdk:dsql:2.31.78" )
27+ implementation(project(" :aws-advanced-jdbc-wrapper" ))
28+ }
Original file line number Diff line number Diff line change 1+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+ #
3+ # Licensed under the Apache License, Version 2.0 (the "License").
4+ # You may not use this file except in compliance with the License.
5+ # You may obtain a copy of the License at
6+ #
7+ # http://www.apache.org/licenses/LICENSE-2.0
8+ #
9+ # Unless required by applicable law or agreed to in writing, software
10+ # distributed under the License is distributed on an "AS IS" BASIS,
11+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ # See the License for the specific language governing permissions and
13+ # limitations under the License.
14+
15+ # Do not publish the Jar file for this subproject
16+ nexus.publish =false
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License").
5+ * You may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
17+ package software .amazon .SpringBootHikariDsqlExample ;
18+
19+ import org .springframework .beans .factory .annotation .Autowired ;
20+ import org .springframework .jdbc .core .JdbcTemplate ;
21+ import org .springframework .web .bind .annotation .GetMapping ;
22+ import org .springframework .web .bind .annotation .RestController ;
23+
24+ @ RestController
25+ public class ApiController {
26+
27+ @ Autowired
28+ private JdbcTemplate jdbcTemplate ;
29+
30+ @ GetMapping (value = "/select1" )
31+ public Integer getOne () {
32+ return jdbcTemplate .queryForObject ("SELECT 1;" , Integer .class );
33+ }
34+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License").
5+ * You may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
17+ package software .amazon .SpringBootHikariDsqlExample ;
18+
19+ import org .springframework .boot .SpringApplication ;
20+ import org .springframework .boot .autoconfigure .SpringBootApplication ;
21+
22+ @ SpringBootApplication
23+ public class SpringBootHikariExampleApplication {
24+ public static void main (String [] args ) {
25+ SpringApplication .run (SpringBootHikariExampleApplication .class , args );
26+ }
27+ }
Original file line number Diff line number Diff line change 1+ spring :
2+ datasource :
3+ url : jdbc:aws-wrapper:postgresql://cluster-identifier.dsql.us-east-1.on.aws:5432/postgres
4+ username : admin
5+ driver-class-name : software.amazon.jdbc.Driver
6+ hikari :
7+ data-source-properties :
8+ wrapperPlugins : dsql
9+ wrapperDialect : pg
10+ max-lifetime : 840000
11+ minimum-idle : 20
12+ maximum-pool-size : 20
13+ idle-timeout : 900000
14+ read-only : true
Original file line number Diff line number Diff line change 66 * You may obtain a copy of the License at
77 *
88 * http://www.apache.org/licenses/LICENSE-2.0
9- *:eq
9+ *
1010 * Unless required by applicable law or agreed to in writing, software
1111 * distributed under the License is distributed on an "AS IS" BASIS,
1212 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ include(
2828 " springhibernateonedatasource" ,
2929 " springhibernatetwodatasource" ,
3030 " springwildfly" ,
31+ " springboothikaridsqlexample" ,
3132 " springboothikariexample" ,
3233 " springtxfailover" ,
3334 " vertxexample" ,
@@ -44,6 +45,7 @@ project(":springhibernate").projectDir = file("examples/SpringHibernateExample")
4445project(" :springhibernateonedatasource" ).projectDir = file(" examples/SpringHibernateBalancedReaderOneDataSourceExample" )
4546project(" :springhibernatetwodatasource" ).projectDir = file(" examples/SpringHibernateBalancedReaderTwoDataSourceExample" )
4647project(" :springwildfly" ).projectDir = file(" examples/SpringWildflyExample/spring" )
48+ project(" :springboothikaridsqlexample" ).projectDir = file(" examples/SpringBootHikariDsqlExample" )
4749project(" :springboothikariexample" ).projectDir = file(" examples/SpringBootHikariExample" )
4850project(" :springtxfailover" ).projectDir = file(" examples/SpringTxFailoverExample" )
4951project(" :vertxexample" ).projectDir = file(" examples/VertxExample" )
You can’t perform that action at this time.
0 commit comments