需求和需要模块声明中的传递模块语句有什么区别?
例如:
module foo {
requires java.base;
requires transitive java.compiler;
}
Run Code Online (Sandbox Code Playgroud) 该文件welcome.rb包含:
welcome_message = "hi there"
Run Code Online (Sandbox Code Playgroud)
但是在IRB中,我无法访问刚刚创建的变量:
require './welcome.rb'
puts welcome_message
# => undefined local variable or method `welcome_message' for main:Object
Run Code Online (Sandbox Code Playgroud)
当您require进入IRB会话时,引入预定义变量并完成初始化工作的最佳方法是什么?全局变量似乎不是正确的路径.
这似乎是一个简单的问题,但文档似乎没有任何关于这个主题的说法.我想做点什么,Requires: vim or emacs但是当我这样做时,我实际上依赖于vim,or而且emacs.取决于两个包中的一个或另一个的语法是什么?
我的服务类.
@Service
@Transactional(value = "transactionManager", readOnly = true, propagation = Propagation.REQUIRED)
public class DeviceServiceImpl{
@Transactional(readOnly = false)
public void blockAllDevices(){
createSmsDeviceBlock();
}
public void createSmsDeviceBlock(){
addToLogTables();
smsService.sendSms();
}
@Transactional(readOnly = false,propagation = Propagation.REQUIRES_NEW)
public void addToLogTables(){
try {
//save object with DAO methods...
} catch (Exception e) {
throw new ServiceException(ServiceException.PROCESSING_FAILED, e.getMessage(), e);
}
}
Run Code Online (Sandbox Code Playgroud)
}
从我的控制器,服务方法blockAllDevices()被调用.addToLogTables()方法被标记为Propergation.REQUIRED_NEW,但问题是addToLogTables()方法没有创建新事务并且现有事务正在使用.
我想要做的是,addToLogTables()方法上的事务应该在执行smsService.sendSms()方法之前提交.
我的问题在于,如果事务无法提交,则在方法addToLogTables()方法中,它不应该执行smsService.sendSms()方法.
requires ×4
dependencies ×1
irb ×1
java ×1
java-9 ×1
java-module ×1
module-info ×1
propagation ×1
required ×1
rpm ×1
ruby ×1
scope ×1
spring ×1
transactions ×1
variables ×1