Skip to content

Commit 0d51a47

Browse files
committed
Update Gradle wrapper and enhance logging in DotEnvConfiguration
- Updated Gradle wrapper distribution URL to version 9.0.0. - Replaced System.out logging with SLF4J logging in DotEnvConfiguration for better logging practices. - Added @JsonIgnoreProperties annotation to RestResponseSlice to ignore unknown properties during JSON deserialization. These changes improve project configuration and logging consistency.
1 parent 31302ce commit 0d51a47

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

src/main/java/org/couchbase/quickstart/springdata/config/DotEnvConfiguration.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package org.couchbase.quickstart.springdata.config;
22

33
import io.github.cdimascio.dotenv.Dotenv;
4+
import org.slf4j.Logger;
5+
import org.slf4j.LoggerFactory;
46
import org.springframework.context.ApplicationContextInitializer;
57
import org.springframework.context.ConfigurableApplicationContext;
68
import org.springframework.core.env.ConfigurableEnvironment;
@@ -11,6 +13,8 @@
1113

1214
public class DotEnvConfiguration implements ApplicationContextInitializer<ConfigurableApplicationContext> {
1315

16+
private static final Logger log = LoggerFactory.getLogger(DotEnvConfiguration.class);
17+
1418
@Override
1519
public void initialize(ConfigurableApplicationContext applicationContext) {
1620
ConfigurableEnvironment environment = applicationContext.getEnvironment();
@@ -32,17 +36,17 @@ public void initialize(ConfigurableApplicationContext applicationContext) {
3236
// Only add if not already set by system environment
3337
if (System.getenv(key) == null) {
3438
envMap.put(key, value);
35-
System.out.println("Loaded from .env: " + key);
39+
log.debug("Loaded from .env: {}", key);
3640
}
3741
});
3842

3943
if (!envMap.isEmpty()) {
4044
environment.getPropertySources().addFirst(new MapPropertySource("dotenv", envMap));
41-
System.out.println("Environment variables loaded from .env file: " + envMap.keySet());
45+
log.info("Environment variables loaded from .env file: {}", envMap.keySet());
4246
}
4347

4448
} catch (Exception e) {
45-
System.err.println("Could not load .env file: " + e.getMessage());
49+
log.error("Could not load .env file", e);
4650
}
4751
}
4852
}

src/main/java/org/couchbase/quickstart/springdata/models/RestResponseSlice.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
import org.springframework.data.domain.SliceImpl;
77

88
import com.fasterxml.jackson.annotation.JsonCreator;
9+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
910
import com.fasterxml.jackson.annotation.JsonProperty;
1011
import com.fasterxml.jackson.databind.JsonNode;
1112

13+
@JsonIgnoreProperties(ignoreUnknown = true)
1214
public class RestResponseSlice<T> extends SliceImpl<T> {
1315
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
1416
public RestResponseSlice(@JsonProperty("content") List<T> content,
@@ -21,6 +23,8 @@ public RestResponseSlice(@JsonProperty("content") List<T> content,
2123
@JsonProperty("numberOfElements") int numberOfElements,
2224
@JsonProperty("hasNext") boolean hasNext) {
2325

26+
// Calculate hasNext from the available information
27+
// For Slice, hasNext is typically determined by whether we have more content
2428
super(content, PageRequest.of(number, size), hasNext);
2529
}
2630

0 commit comments

Comments
 (0)