Java 类org.springframework.boot.context.config.ResourceNotFoundException 实例源码

项目:druid-spring-boot    文件:DruidDataSourceInitializer.java   
private List<Resource> getResources(String propertyName, List<String> locations,
                                    boolean validate) {
    List<Resource> resources = new ArrayList<Resource>();
    for (String location : locations) {
        for (Resource resource : doGetResources(location)) {
            if (resource.exists()) {
                resources.add(resource);
            } else if (validate) {
                throw new ResourceNotFoundException(propertyName, resource);
            }
        }
    }
    return resources;
}
项目:spring-boot-multidatasource    文件:DataSourceInitializer.java   
private List<Resource> getResources(String propertyName, List<String> locations,
        boolean validate) {
    List<Resource> resources = new ArrayList<Resource>();
    for (String location : locations) {
        for (Resource resource : doGetResources(location)) {
            if (resource.exists()) {
                resources.add(resource);
            }
            else if (validate) {
                throw new ResourceNotFoundException(propertyName, resource);
            }
        }
    }
    return resources;
}
项目:spring-rest-commons-options    文件:ExceptionHandlerForJunit.java   
@ResponseStatus(HttpStatus.NOT_FOUND)
@ExceptionHandler(ResourceNotFoundException.class)
public @ResponseBody ErrorInfo handlerResourceNotFoundException(ResourceNotFoundException ex) {
    return new ErrorInfo(String.valueOf(HttpStatus.NOT_FOUND.value()), ex.getMessage());
}
项目:stock-tracker    文件:GlobalExceptionHandler.java   
@ResponseStatus(HttpStatus.NOT_FOUND)
@ExceptionHandler(ResourceNotFoundException.class)
public String handleResourceNotFoundException() {
    log.error("Resource not found");
    return "error";
}