diff --git a/src/main/java/cokr/xit/interfaces/disabledparking/service/bean/GPKI.java b/src/main/java/cokr/xit/interfaces/disabledparking/service/bean/GPKI.java index c2a263e..1d477ed 100644 --- a/src/main/java/cokr/xit/interfaces/disabledparking/service/bean/GPKI.java +++ b/src/main/java/cokr/xit/interfaces/disabledparking/service/bean/GPKI.java @@ -37,10 +37,6 @@ public class GPKI extends AbstractComponent { private gpkiapi_jni gpki; - static { - init(); - } - /**주어진 문자열을 지정한 아이디의 서버인증서로 암호화하여 반환한다. * @param serverID 서버인증서 아이디 * @param data 문자열 @@ -91,6 +87,8 @@ public class GPKI extends AbstractComponent { } private static void init() { + if (!serverCerts.isEmpty()) return; + try { GpkiApi.init(conf.license); gpkiapi_jni gpki = getGpki(); @@ -230,6 +228,7 @@ public class GPKI extends AbstractComponent { if (gpki != null) return false; try { + init(); gpki = getGpki(); return true; } catch (Exception e) { diff --git a/src/test/java/cokr/xit/interfaces/disabledparking/service/DisabledParkingServiceTest.java b/src/test/java/cokr/xit/interfaces/disabledparking/service/DisabledParkingServiceTest.java index fd48e4d..d7f2736 100644 --- a/src/test/java/cokr/xit/interfaces/disabledparking/service/DisabledParkingServiceTest.java +++ b/src/test/java/cokr/xit/interfaces/disabledparking/service/DisabledParkingServiceTest.java @@ -12,6 +12,8 @@ import cokr.xit.interfaces.disabledparking.service.bean.DisabledParkingBean; import cokr.xit.interfaces.disabledparking.service.bean.GPKI; public class DisabledParkingServiceTest extends TestSupport { + @Resource(name = "disabledParkingBean") + private DisabledParkingBean bean; @Resource(name = "disabledParkingService") private DisabledParkingService service; @@ -50,7 +52,7 @@ public class DisabledParkingServiceTest extends TestSupport { "56저2472", "Y" ) .forEach((k, v) -> { - Map result = service.getParkingInfo(k); + Map result = bean.getParkingInfo(k); Assertions.assertEquals(v, result.get("PARKING_PSBL_YN")); }); }