Controller implementing normal interface for default method of JAVA interface

Viewed 159
  1. A class containing
    package com.data.job.controller;

    @Controller
    public class SomeController implements SomeUtility {

    @RequestMapping(value = { "/v3/jobs/upload" }, method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse upload(UploadItem uploadItem, BindingResult result, HttpServletResponse servletResponse) throws IOException {
    // SomeHandler method used in between
    return response;
    }
  1. An interface with default method:
    package com.data.upload.util;
    public interface SomeUtility {  
        default String SomeHandler(String value) {
            try {
                if (null != value) {
                    long keyName = Double.valueOf((value.trim())).longValue();
                    return String.valueOf(keyName);
                }
            } catch (NumberFormatException nfe) {
            }
            return value;
        }
    }

but while calling controller its giving 404 handler not found. If I removed implementation of SomeUtility its working fine.

0 Answers
Related