Passing varargs to Spring spEL causes “Method cannot be found on com.sun.proxy”

回眸只為那壹抹淺笑 提交于 2019-12-02 06:25:59

What version of Spring are you using? I just ran this test case with 4.3.12 and it worked fine...

@SpringBootApplication
public class So46953884Application {

    public static void main(String[] args) {
        SpringApplication.run(So46953884Application.class, args);
    }

    @Value("#{foo.foo('a', 'b')}")
    private String foo;

    @Bean
    public ApplicationRunner runner() {
        return args -> System.out.println(foo);
    }

    @Bean
    public Foo foo() {
        return new Foo();
    }

    public static class Foo {

        public String foo(String... strings) {
            return "filled: " + Arrays.toString(strings);
        }

    }

}

Result:

filled: [a, b]
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!