标签: requires

需求和需要Java 9中的传递语句有什么区别?

需求需要模块声明中的传递模块语句有什么区别?

例如:

module foo {
    requires java.base;
    requires transitive java.compiler;
}
Run Code Online (Sandbox Code Playgroud)

java requires java-9 java-module module-info

54
推荐指数
3
解决办法
6606
查看次数

如何访问IRB中所需的Ruby文件中定义的变量?

该文件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会话时,引入预定义变量并完成初始化工作的最佳方法是什么?全局变量似乎不是正确的路径.

ruby variables scope irb requires

16
推荐指数
1
解决办法
5423
查看次数

如何使RPM依赖于包OR包?

这似乎是一个简单的问题,但文档似乎没有任何关于这个主题的说法.我想做点什么,Requires: vim or emacs但是当我这样做时,我实际上依赖于vim,or而且emacs.取决于两个包中的一个或另一个的语法是什么?

dependencies rpm requires

9
推荐指数
2
解决办法
6782
查看次数

spring transaction management Propagation.REQUIRES_NEW无效

我的服务类.

@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()方法.

spring transactions propagation required requires

3
推荐指数
1
解决办法
4101
查看次数