我有spring boot库(打包有依赖项),现在从我的Oracle BPEL Java嵌入中,当我调用spring boot库时,我无法使用lambda表达式,因为仅从Spring 4.0支持lambda。我正在使用Spring 5.0。
Oracle SOA套件使用来自“ Oracle_Home \ oracle_common \ modules \ ”,默认为“ org.springframework_3.1.0.jar”。如何强制使用Spring 5.0
Java嵌入代码
TestC.testCal();
TestC类
public class TestC {
@Autowired
TestCall testCall;
public static void testCal() {
final File f = new File(MultiValueMap.class.getProtectionDomain()
.getCodeSource()
.getLocation()
.getPath());
System.out.println("File path : " + f.getAbsolutePath());
ApplicationContext ctx = SpringApplication.run(TestC.class, null);
TestCall testCall1 = ctx.getBean(TestCall.class);
testCall1.callMeTest(); // Spring boot lambda Method
}
}
Lambda代码
ArrayList<Integer> arrL = new ArrayList<Integer>();
arrL.add(1);
arrL.add(2);
arrL.add(3);
arrL.add(4);
// Using lambda expression to print all elements
// of arrL
arrL.forEach(n -> System.out.println(n));