Skip to content

Commit 9610884

Browse files
committed
Update versions and recipe
1 parent adb372d commit 9610884

File tree

2 files changed

+81
-10
lines changed

2 files changed

+81
-10
lines changed

recipes/hikariucp/pom.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444
<maven.compiler.source>17</maven.compiler.source>
4545
<maven.compiler.target>17</maven.compiler.target>
4646
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
47-
<rewrite.version>8.47.2</rewrite.version> <!-- Latest as of Mar 2025 -->
48-
<rewrite.recipe.version>3.3.0</rewrite.recipe.version> <!-- Latest as of Mar 2025 -->
49-
<maven.rewrite.plugin.version>6.2.1</maven.rewrite.plugin.version>
50-
<junit.version>5.12.0</junit.version> <!-- Latest as of Mar 2025 -->
47+
<rewrite.version>8.48.1</rewrite.version> <!-- Latest as of Mar 2025 -->
48+
<rewrite.recipe.version>3.3.0</rewrite.recipe.version> <!-- Latest as of Mar 2025 -->
49+
<maven.rewrite.plugin.version>6.3.2</maven.rewrite.plugin.version> <!-- Latest as of Mar 2025 -->
50+
<junit.version>5.12.1</junit.version> <!-- Latest as of Mar 2025 -->
5151
</properties>
5252

5353
<dependencies>

recipes/hikariucp/src/main/resources/META-INF/rewrite/rewrite.yml

+77-6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ tags:
1717
recipeList:
1818

1919
# For pom.xml
20+
- org.openrewrite.java.dependencies.RemoveDependency:
21+
GroupId: com.oracle.database.jdbc
22+
ArtifactId: ojdbc*
2023
- org.openrewrite.java.dependencies.RemoveDependency:
2124
groupId: com.zaxxer*
2225
artifactId: HikariCP*
@@ -29,6 +32,80 @@ recipeList:
2932
artifactId: oracle-spring-boot-starter-wallet
3033
version: 25.1.0
3134

35+
# https://docs.openrewrite.org/recipes/java/spring/addspringproperty
36+
# Add a spring configuration property to a configuration file if it does not already exist in that file.
37+
- org.openrewrite.java.spring.AddSpringProperty:
38+
property: spring.datasource.driver-class-name
39+
value: oracle.jdbc.OracleDriver
40+
comment: "JDBC driver class"
41+
pathExpressions: ["**/application.properties"]
42+
43+
- org.openrewrite.java.spring.AddSpringProperty:
44+
property: spring.datasource.type
45+
value: oracle.ucp.jdbc.PoolDataSource
46+
comment: specify the connection pool driver to use"
47+
pathExpressions: ["**/application.properties"]
48+
49+
- org.openrewrite.java.spring.AddSpringProperty:
50+
property: spring.datasource.oracleucp.connection-pool-name
51+
value: UCPConnectionPool
52+
comment: "Connection Pool Name"
53+
pathExpressions: ["**/application.properties"]
54+
55+
- org.openrewrite.java.spring.AddSpringProperty:
56+
property: spring.datasource.oracleucp.max-pool-size
57+
value: 20
58+
comment: "Specifies the maximum number of available and borrowed connections that our pool is maintaining"
59+
pathExpressions: ["**/application.properties"]
60+
61+
- org.openrewrite.java.spring.AddSpringProperty:
62+
property: spring.datasource.oracleucp.min-pool-size
63+
value: 5
64+
comment: "Specifies the minimum number of available and borrowed connections that our pool is maintaining"
65+
pathExpressions: ["**/application.properties"]
66+
67+
- org.openrewrite.java.spring.AddSpringProperty:
68+
property: spring.datasource.oracleucp.initial-pool-size
69+
value: 10
70+
comment: "Specifies the number of available connections created after the pool is initiated"
71+
pathExpressions: ["**/application.properties"]
72+
73+
- org.openrewrite.java.spring.AddSpringProperty:
74+
property: spring.datasource.oracleucp.connection-wait-timeout
75+
value: 3
76+
comment: "specifies how long an application request waits to obtain a connection if there are no longer any connections in the pool"
77+
pathExpressions: ["**/application.properties"]
78+
79+
- org.openrewrite.java.spring.AddSpringProperty:
80+
property: spring.datasource.oracleucp.inactive-connection-timeout
81+
value: 0
82+
comment: "Specifies how long an available connection can remain idle before it is closed and removed from the pool"
83+
pathExpressions: ["**/application.properties"]
84+
85+
- org.openrewrite.java.spring.AddSpringProperty:
86+
property: spring.datasource.oracleucp.max-connection-reuse-time
87+
value: 0
88+
comment: "Allows connections to be gracefully closed and removed from a connection pool after a specific amount of time"
89+
pathExpressions: ["**/application.properties"]
90+
91+
- org.openrewrite.java.spring.AddSpringProperty:
92+
property: spring.datasource.oracleucp.connection-validation-timeout
93+
value: 15
94+
comment: "Specifies the duration within which a borrowed connection from the pool is validated"
95+
pathExpressions: ["**/application.properties"]
96+
97+
- org.openrewrite.java.spring.AddSpringProperty:
98+
property: spring.datasource.oracleucp.fast-connection-failover-enabled
99+
value: false
100+
comment: "Enables faster failover for connection attempts"
101+
pathExpressions: ["**/application.properties"]
102+
103+
- org.openrewrite.java.spring.AddSpringProperty:
104+
property: spring.datasource.oracleucp.validate-connection-on-borrow
105+
value: false
106+
comment: "Whether to validate connections when borrowed from the pool"
107+
pathExpressions: ["**/application.properties"]
108+
32109
# spring.datasource.oracleucp.connection-factory-class: oracle.jdbc.pool.OracleDataSource
33110
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
34111
oldPropertyKey: spring.datasource.hikari.data-source-class-name
@@ -87,12 +164,6 @@ recipeList:
87164
oldPropertyKey: spring.datasource.hikari.validation-timeout
88165
newPropertyKey: spring.datasource.oracleucp.connection-validation-timeout
89166

90-
# spring.datasource.oracleucp.initial-pool-size
91-
- org.openrewrite.java.spring.AddSpringProperty:
92-
property: spring.datasource.oracleucp.initial-pool-size
93-
value: 5
94-
comment: "Specifies the number of available connections created after the pool is initiated"
95-
96167
# HikariCP properties that don’t have identical UCP properties
97168
- org.openrewrite.java.spring.CommentOutSpringPropertyKey:
98169
propertyKey: spring.datasource.hikari.auto-commit

0 commit comments

Comments
 (0)