package com.imprimelibros.erp.configurationERP; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class VariableService { @Autowired private VariableRepository variableRepository; public Integer getValorEntero(String clave) { return variableRepository.findByClave(clave) .map(v -> Integer.parseInt(v.getValor())) .orElseThrow( () -> new IllegalArgumentException("No se encontrĂ³ la variable con clave '" + clave + "'")); } }