Fixing merge

This commit is contained in:
Ryan Baxter
2023-03-22 20:22:08 -04:00
parent fab9ceb0e5
commit 63e70ee9d8
2 changed files with 17 additions and 0 deletions

View File

@@ -16,6 +16,10 @@
package org.springframework.cloud.config.server.resource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.cloud.config.server.environment.NoSuchLabelException;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
@@ -29,9 +33,17 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
@Order
class ResourceControllerAdvice {
private static Log logger = LogFactory.getLog(ResourceControllerAdvice.class);
@ExceptionHandler(NoSuchResourceException.class)
@ResponseStatus(HttpStatus.NOT_FOUND)
void notFound(NoSuchResourceException e) {
}
@ExceptionHandler(NoSuchLabelException.class)
@ResponseStatus(HttpStatus.NOT_FOUND)
void noSuchLabel(NoSuchLabelException e) {
logger.debug("Error when fetching resource", e);
}
}

View File

@@ -194,6 +194,11 @@ public class ResourceControllerIntegrationTests {
return new ResourceController(resourceRepository(), environmentRepository(), resourceEncryptorMap);
}
@Bean
public ResourceControllerAdvice resourceControllerAdvice() {
return new ResourceControllerAdvice();
}
}
}