我正在阅读流抽象的java 8 API,但我不太理解这句话:
中间操作返回一个新流.他们总是懒惰; 执行诸如filter()之类的中间操作实际上并不执行任何过滤,而是创建一个新流,当遍历时,该流包含与给定谓词匹配的初始流的元素.在执行管道的终端操作之前,不会开始遍历管道源.
当过滤操作创建新流时,该流是否包含已过滤的元素?似乎理解流仅在遍历时才包含元素,即具有终端操作.但是,包含过滤流的内容是什么?我糊涂了!!!
我在进行批处理时遇到以下异常
encountered an error.org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
at java.util.concurrent.FutureTask.get(FutureTask.java:111)
Run Code Online (Sandbox Code Playgroud)
有人可以帮我解决可能出现的问题吗?
谢谢.
我有一个Spring控制器定义如下:
@Controller
@RequestMapping("/queue")
public class QueueController {
QueuesService queueService;
public QueueController(QueuesService queueService) {
if (queueService == null) {
throw new IllegalArgumentException("QueueService cannot be null");
}
this.queueService = queueService;
}
}
Run Code Online (Sandbox Code Playgroud)
我的context-configuration文件中的相应条目如下(其中bean定义没有任何"id"属性):
<bean class="com.xy.web.controllers.QueueController">
<constructor-arg ref="queueServiceImpl"></constructor-arg>
</bean>
Run Code Online (Sandbox Code Playgroud)
现在,在应用程序启动期间,Spring正在抛出异常:
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.xy.web.controllers.QueueController]: No default constructor found; nested exception is java.lang.NoSuchMethodException: com.xy.web.controllers.QueueController.<init>()
Run Code Online (Sandbox Code Playgroud)
但是,当我将"id"属性添加到"bean定义"(如下所示)时,它的创建正确.
<bean id="queueController" class="com.xy.web.controllers.QueueController">
<constructor-arg ref="queueServiceImpl"></constructor-arg>
</bean>
Run Code Online (Sandbox Code Playgroud)
对此的任何解释或我在这里遗漏了什么?