{"id":1618,"date":"2005-08-20T13:03:00","date_gmt":"2005-08-20T13:03:00","guid":{"rendered":"http:\/\/t.motd.kr\/articles\/1618\/java-spi-service-provider-interface"},"modified":"2022-12-28T01:48:34","modified_gmt":"2022-12-27T16:48:34","slug":"java-spi-%ec%86%8c%ea%b0%9c-service-provider-interface","status":"publish","type":"post","link":"https:\/\/vault.motd.kr\/wordpress\/posts\/1618\/java-spi-%ec%86%8c%ea%b0%9c-service-provider-interface\/","title":{"rendered":"Java SPI \uc18c\uac1c: Service Provider Interface"},"content":{"rendered":"\n
Java 1.3 \uc5d0\uc11c \u2018SPI (Service Provider Interface)\u2019 \ub77c\ub294 \uae30\ub2a5\uc774 \uc18c\uac1c\ub418\uc5c8\uc2b5\ub2c8\ub2e4. JDK \ud328\ud0a4\uc9c0 \ubaa9\ub85d\uc744 \ubcf4\uba74 \u2018 \uc124\uba85\uc744 \uc77d\uc5b4 \ubcf4\uba74 \ud2b9\uc815\ud55c \uc5ed\ud560\uc744 \ud558\ub294 \uc11c\ube44\uc2a4 \ucef4\ud3ec\ub10c\ud2b8\ub97c \uc0ac\uc6a9\uc790\uac00 \uad6c\ud604\ud560 \uc218 \uc788\ub3c4\ub85d \ud574 \uc8fc\ub294 \ud655\uc7a5 \uba54\ucee4\ub2c8\uc998 (extension mechanism) \uc784\uc744 \uc54c \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc774\uc81c \ub300\ud55c \uc790\uc138\ud55c \uc124\uba85\uc740 JAR File Specification<\/a>\uc758 Service Provider \uc139\uc158<\/a>\uc5d0\uc11c \ucc3e\uc544\ubcfc \uc218 \uc788\uc2b5\ub2c8\ub2e4:<\/p>\n\n\n\n 1. JAR \uc758 2. SPI \ub97c \uc0ac\uc6a9\ud558\ub294 \uc5b4\ud50c\ub9ac\ucf00\uc774\uc158\uc5d0\uc11c \ub9cc\uc57d JDBC \ub3c4 \uc774\ub7ec\ud55c \ubc29\ubc95\uc73c\ub85c \uad6c\ud604\ud55c\ub2e4\uba74 \ub2e8\uc21c\ud788 JAR \ud30c\uc77c\uc744 \ud074\ub798\uc2a4 \ud328\uc2a4\uc5d0 \uc9d1\uc5b4\ub123\ub294 \uac83\ub9cc\uc73c\ub85c\ub3c4 \ub4dc\ub77c\uc774\ubc84\uac00 \uc790\ub3d9 \ub4f1\ub85d\ub420\ud14c\uace0, \ub530\ub77c\uc11c \uc124\uc815 \ud30c\uc77c\uc5d0 JDBC \ub4dc\ub77c\uc774\ubc84 \ud074\ub798\uc2a4 \uc774\ub984\uc744 \uad82\uc774 \uc801\uc9c0 \uc54a\uc544\ub3c4 \ub418\uc9c0 \uc54a\uc558\uc744\uae4c \ud569\ub2c8\ub2e4.<\/p>\n\n\n\n \uc8fc\uc758<\/span>: Java 1.3 \uc5d0\uc11c \u2018SPI (Service Provider Interface)\u2019 \ub77c\ub294 \uae30\ub2a5\uc774 \uc18c\uac1c\ub418\uc5c8\uc2b5\ub2c8\ub2e4. JDK \ud328\ud0a4\uc9c0 \ubaa9\ub85d\uc744 \ubcf4\uba74 \u2018java.nio.charset.spi\u2018 \uc640 \uac19\uc774 \u2018spi\u2018 \ub85c \ub05d\ub098\ub294 \ud328\ud0a4\uc9c0\ub4e4\uc774 \uc5ec\ub7ff \ubcf4\uc785\ub2c8\ub2e4. \uc5ec\ub7ec \uacf3\uc5d0\uc11c \uc54c\uac8c \ubaa8\ub974\uac8c \uc4f0\uc774\uace0 \uc788\uc9c0\ub9cc \ud070 \uad00\uc2ec\uc740 \ub450\uc9c0 \uc54a\uace0 \uc788\uc5c8\ub294\ub370, Lorentz 3.0 \uc744 \uac1c\ubc1c\ud558\uba74\uc11c JAR\ub9cc \ud074\ub798\uc2a4\ud328\uc2a4\uc5d0 \ub123\uc73c\uba74 \uc790\ub3d9\uc73c\ub85c Converter \uac00 \ub4f1\ub85d\ub418\uac8c \ud558\uace0 \uc2f6\uc5b4 \uad00\uc2ec\uc744 \uac16\uac8c \ub418\uc5c7\uc2b5\ub2c8\ub2e4. \uc124\uba85\uc744 \uc77d\uc5b4 \ubcf4\uba74 \ud2b9\uc815\ud55c \uc5ed\ud560\uc744… Continue reading java.nio.charset.spi<\/code>\u2018 \uc640 \uac19\uc774 \u2018
spi<\/code>\u2018 \ub85c \ub05d\ub098\ub294 \ud328\ud0a4\uc9c0\ub4e4\uc774 \uc5ec\ub7ff \ubcf4\uc785\ub2c8\ub2e4. \uc5ec\ub7ec \uacf3\uc5d0\uc11c \uc54c\uac8c \ubaa8\ub974\uac8c \uc4f0\uc774\uace0 \uc788\uc9c0\ub9cc \ud070 \uad00\uc2ec\uc740 \ub450\uc9c0 \uc54a\uace0 \uc788\uc5c8\ub294\ub370, Lorentz 3.0 \uc744 \uac1c\ubc1c\ud558\uba74\uc11c JAR\ub9cc \ud074\ub798\uc2a4\ud328\uc2a4\uc5d0 \ub123\uc73c\uba74 \uc790\ub3d9\uc73c\ub85c
Converter<\/code> \uac00 \ub4f1\ub85d\ub418\uac8c \ud558\uace0 \uc2f6\uc5b4 \uad00\uc2ec\uc744 \uac16\uac8c \ub418\uc5c7\uc2b5\ub2c8\ub2e4.<\/p>\n\n\n\n
META-INF\/services\/<\/code><\ud504\ub85c\ubc14\uc774\ub354 \uc778\ud130\ud398\uc774\uc2a4 \ud074\ub798\uc2a4\uba85> \ud14d\uc2a4\ud2b8 \ud30c\uc77c\uc5d0 \ud574\ub2f9 \uc778\ud130\ud398\uc774\uc2a4 (\ub610\ub294 \ucd94\uc0c1 \ud074\ub798\uc2a4) \ub97c \uad6c\ud604\ud558\ub294 \ud074\ub798\uc2a4\ub4e4\uc758 \ubaa9\ub85d\uc744 \uc801\uc2b5\ub2c8\ub2e4:<\/p>\n\n\n\n
META-INF\/services\/net.gleamynode.conversion.ConverterPack:\nnet.gleamynode.conversion.convert.jmx10.Jmx10ConverterPack\nnet.gleamynode.conversion.convert.jdk14.Jdk14ConverterPack\n......<\/code><\/pre>\n\n\n\n
Service.providers(Class providerType)<\/code> \ub97c \ud638\ucd9c\ud558\uc5ec \uad6c\ud604 \ud074\ub798\uc2a4\ub4e4\uc758 \ub514\ud3f4\ud2b8 \ucee8\uc2a4\ud2b8\ub7ed\ud130\ub85c \uc0dd\uc131\ub41c \uc778\uc2a4\ud134\uc2a4\ub4e4\uc758 \ubaa9\ub85d\uc744 \uc5bb\uc5b4\ub0bc \uc218 \uc788\uc2b5\ub2c8\ub2e4:<\/p>\n\n\n\n
static {\n \/\/ Register all service providers when this class is loaded.\n registerServiceProviders();\n}\n\npublic static void registerServiceProviders() {\n \/\/ Register all ConverterPack providers.\n for (Enumeration e = Service.providers(ConverterPack.class);\n e.hasMoreElements();) {\n ConverterPack p = (ConverterPack) e.nextElement();\n register(p);\n }\n\n \/\/ Register all Converter providers.\n for (Enumeration e = Service.providers(Converter.class);\n e.hasMoreElements();) {\n Converter c = (Converter) e.nextElement();\n register(c);\n }\n}<\/code><\/pre>\n\n\n\n
Service<\/code> \ub294 JDK \uacf5\uc2dd API \uac00 \uc544\ub2cc,
sun.misc<\/code> \ud328\ud0a4\uc9c0\uac00 \uc81c\uacf5\ud558\ub294 \ud50c\ub7ab\ud3fc \uc885\uc18d\uc801 \ud074\ub798\uc2a4\uc785\ub2c8\ub2e4. \ub530\ub77c\uc11c \uadf8 \ub300\uc548\uc778 Jakarta Commons-Discovery<\/a>\ub97c \uc774\uc6a9\ud558\uc154\uc57c \ud569\ub2c8\ub2e4.<\/p>\n","protected":false},"excerpt":{"rendered":"