{"id":407,"date":"2014-06-10T23:23:47","date_gmt":"2014-06-10T14:23:47","guid":{"rendered":"http:\/\/www.typea.info\/blog\/index.php\/2014\/06\/10\/java_ee_7_13_jbatch_rest\/"},"modified":"2014-06-10T23:23:47","modified_gmt":"2014-06-10T14:23:47","slug":"java_ee_7_13_jbatch_rest","status":"publish","type":"post","link":"https:\/\/www.typea.info\/blog\/index.php\/2014\/06\/10\/java_ee_7_13_jbatch_rest\/","title":{"rendered":"Java EE 7 \u691c\u8a3c\u74b0\u5883\u69cb\u7bc9(13) jBatch REST \u30b5\u30fc\u30d3\u30b9\u7d4c\u7531\u3067\u5b9f\u884c\u3059\u308b"},"content":{"rendered":"<ol>\n<li><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2014\/04\/28\/java_ee_7_1_wildfly_jboss_tools_ear_arquillian\">Java EE 7 \u691c\u8a3c\u74b0\u5883\u69cb\u7bc9(1) WildFly + JBoss Tools \u3067 EAR\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057 Arquillian \u3067 \u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u3092\u30b0\u30ea\u30fc\u30f3\u306b\u3059\u308b\u3068\u3053\u308d\u307e\u3067<\/a><\/li>\n<li><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2014\/04\/28\/java_ee_7_2_wildfly_datasource\">Java EE 7 \u691c\u8a3c\u74b0\u5883\u69cb\u7bc9(2) WildFly \u306b DataSource\u3092\u4f5c\u6210<\/a><\/li>\n<li><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2014\/04\/29\/java_ee_7_3_jpamysqlarquillian\">Java EE 7 \u691c\u8a3c\u74b0\u5883\u69cb\u7bc9(3) JPA\u304b\u3089MySQL\u306b\u63a5\u7d9a\u3059\u308b\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u3092Arquillian\u3067\u5b9f\u884c<\/a><\/li>\n<li><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2014\/05\/05\/java_ee_4_java_ee_didependency_injection_cdicontexts_and_dependency_injection\">Java EE 7 \u691c\u8a3c\u74b0\u5883\u69cb\u7bc9(4) Java EE \u3067\u306e DI(Dependency Injection) \u304a\u3088\u3073 CDI(Contexts and Dependency Injection)\u3092\u306a\u304c\u3081\u308b<\/a><\/li>\n<li><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2014\/05\/08\/java_ee_7_5_jboss_toolscdi\">Java EE 7 \u691c\u8a3c\u74b0\u5883\u69cb\u7bc9(5) JBoss Tools\u304c\u751f\u6210\u3057\u305f\u30b5\u30f3\u30d7\u30eb\u30bd\u30fc\u30b9\u306eCDI\u3092\u78ba\u8a8d\u3059\u308b<\/a><\/li>\n<li><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2014\/05\/10\/java_ee_7_6_jpa\">Java EE 7 \u691c\u8a3c\u74b0\u5883\u69cb\u7bc9(6) JPA \u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u306e\u4f5c\u6210\u3068\u633f\u5165<\/a><\/li>\n<li><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2014\/05\/12\/java_ee_7_7_jpa_1\">Java EE 7 \u691c\u8a3c\u74b0\u5883\u69cb\u7bc9(7) JPA \u554f\u3044\u5408\u308f\u305b(1) \u540d\u524d\u4ed8\u304d\u30af\u30a8\u30ea\u3092\u4f7f\u3063\u3066\u307f\u308b\u3002\u30c6\u30b9\u30c8\u3067\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u3082\u610f\u8b58\u3059\u308b<\/a><\/li>\n<li><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2014\/05\/17\/java_ee_7_8_jpa_2_criteria_api\">Java EE 7 \u691c\u8a3c\u74b0\u5883\u69cb\u7bc9(8) JPA \u554f\u3044\u5408\u308f\u305b(2) \u52d5\u7684\u30af\u30a8\u30ea\u3068Criteria API \u3092\u8a66\u3059<\/a><\/li>\n<li><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2014\/05\/25\/java_ee_7_9_jbatch\">Java EE 7 \u691c\u8a3c\u74b0\u5883\u69cb\u7bc9(9) jBatch \u6982\u8981\u3092\u304a\u3055\u3048\u308b<\/a><\/li>\n<li><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2014\/05\/25\/java_ee_7_10_jboss_tools_earjava_ee_6_7\">Java EE 7 \u691c\u8a3c\u74b0\u5883\u69cb\u7bc9(10) JBoss Tools \u3067\u4f5c\u6210\u3057\u305f EAR\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092Java EE 6 \u304b\u3089 7 \u306b\u5909\u66f4\u3059\u308b<\/a><\/li>\n<li><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2014\/05\/30\/java_ee_7_11_jbatch\">Java EE 7 \u691c\u8a3c\u74b0\u5883\u69cb\u7bc9(11) jBatch\u7528 \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u4f5c\u6210\u3092\u884c\u3046<\/a><\/li>\n<li><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2014\/06\/02\/java_ee_7_12_jbatch_arquillian\">Java EE 7 \u691c\u8a3c\u74b0\u5883\u69cb\u7bc9(12) jBatch \u7c21\u6613\u30b5\u30f3\u30d7\u30eb\u4f5c\u6210\u3068 Arquillian \u3067\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8<\/a><\/li>\n<li><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2014\/06\/10\/java_ee_7_13_jbatch_rest\">Java EE 7 \u691c\u8a3c\u74b0\u5883\u69cb\u7bc9(13) jBatch REST \u30b5\u30fc\u30d3\u30b9\u7d4c\u7531\u3067\u5b9f\u884c\u3059\u308b<\/a><\/li>\n<li><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2014\/06\/15\/java_ee_7_14_wildfly_gui\">Java EE 7 \u691c\u8a3c\u74b0\u5883\u69cb\u7bc9(14) WildFly \u306e\u7ba1\u7406\u3092GUI\u3067\u884c\u3046<\/a><\/li>\n<li><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2014\/06\/15\/java_ee_7_15_wildfly_windowslinux\">Java EE 7 \u691c\u8a3c\u74b0\u5883\u69cb\u7bc9(15) WildFly \u3092 \u30b5\u30fc\u30d3\u30b9\u3068\u3057\u3066\u8a2d\u5b9a\u3059\u308b(Windows\/Linux)<\/a><\/li>\n<li><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2014\/06\/26\/java_ee_7_16_wildfly_apache_mod_jk_widows\">Java EE 7 \u691c\u8a3c\u74b0\u5883\u69cb\u7bc9(16) WildFly \u3068 Apache \u3092 mod_jk \u3067\u9023\u643a\u3055\u305b\u308b(Widows)<\/a><\/li>\n<\/ol>\n<p>EJB\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u306e\u3067\u3001Web\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u304b\u3089\u306e\u547c\u3073\u51fa\u3057\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u3092\u5b9f\u65bd\u51fa\u6765\u308b\u3088\u3046\u306b\u3057\u3066\u307f\u308b\u3002<\/p>\n<h2>1.Web\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8<\/h2>\n<p>batch-web \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e pom.xml \u306b\u4ee5\u4e0b\u306e\u8a2d\u5b9a\u3092\u8ffd\u52a0\u3059\u308b\u3002<\/p>\n<p>batch-web \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b REST Web\u30b5\u30fc\u30d3\u30b9\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u30dd\u30a4\u30f3\u30c8\u3092\u4f5c\u6210\u3057\u3001\u305d\u3053\u304b\u3089\u30d0\u30c3\u30c1\u3092\u8d77\u52d5\u3055\u305b\u308b\u3002<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/b8f1e3db5549_FE3C\/jbatch_web_structure.jpg\"><img loading=\"lazy\" decoding=\"async\" title=\"jbatch_web_structure\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;\" border=\"0\" alt=\"jbatch_web_structure\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/b8f1e3db5549_FE3C\/jbatch_web_structure_thumb.jpg\" width=\"201\" height=\"286\" \/><\/a><\/p>\n<h3>1.1 Java EE API \u306e\u53c2\u7167<\/h3>\n<h3><\/h3>\n<p>\u307e\u305a\u3001Web\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u306f\u3001EJB\u3068jBatch \u306e\u53c2\u7167\u304c\u3055\u308c\u3066\u3044\u306a\u3044\u306e\u3067\u3001pom.xml \u306e dependencies \u30a8\u30ec\u30e1\u30f3\u30c8\u914d\u4e0b\u306b\u4ee5\u4e0b\u3092\u8ffd\u8a18\u3059\u308b\u3002<\/p>\n<pre class=\"prettyprint linenums\">&lt;!-- Import the EJB API, we use provided scope as the API is included in JBoss AS 7 --&gt;\r\n&lt;dependency&gt;\r\n    &lt;groupId&gt;org.jboss.spec.javax.ejb&lt;\/groupId&gt;\r\n    &lt;artifactId&gt;jboss-ejb-api_3.2_spec&lt;\/artifactId&gt;\r\n    &lt;scope&gt;provided&lt;\/scope&gt;\r\n&lt;\/dependency&gt;\r\n&lt;dependency&gt; \r\n    &lt;groupId&gt;javax.batch&lt;\/groupId&gt; \r\n    &lt;artifactId&gt;javax.batch-api&lt;\/artifactId&gt; \r\n    &lt;version&gt;1.0&lt;\/version&gt; \r\n    &lt;scope&gt;provided&lt;\/scope&gt;\r\n&lt;\/dependency&gt; <\/pre>\n<h3>1.2 \u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u7528\u30e9\u30a4\u30d6\u30e9\u30ea\u53c2\u7167\u306e\u8ffd\u52a0<\/h3>\n<p>\u307e\u305f\u3001Arquillian \u3067\u30c6\u30b9\u30c8\u3092\u5b9f\u65bd\u3059\u308b\u305f\u3081\u306e\u4f9d\u5b58\u95a2\u4fc2\u3082\u8ffd\u8a18\u3059\u308b\u3002<\/p>\n<pre class=\"prettyprint linenums\">&lt;!-- Test scope dependencies --&gt;\r\n&lt;dependency&gt;\r\n    &lt;groupId&gt;junit&lt;\/groupId&gt;\r\n    &lt;artifactId&gt;junit&lt;\/artifactId&gt;\r\n    &lt;scope&gt;test&lt;\/scope&gt;\r\n&lt;\/dependency&gt;\r\n\r\n&lt;!-- Optional, but highly recommended --&gt;\r\n&lt;!-- Arquillian allows you to test enterprise code such as EJBs and Transactional(JTA) \r\n    JPA from JUnit\/TestNG --&gt;\r\n&lt;dependency&gt;\r\n    &lt;groupId&gt;org.jboss.arquillian.junit&lt;\/groupId&gt;\r\n    &lt;artifactId&gt;arquillian-junit-container&lt;\/artifactId&gt;\r\n    &lt;scope&gt;test&lt;\/scope&gt;\r\n&lt;\/dependency&gt;\r\n\r\n&lt;dependency&gt;\r\n    &lt;groupId&gt;org.jboss.arquillian.protocol&lt;\/groupId&gt;\r\n    &lt;artifactId&gt;arquillian-protocol-servlet&lt;\/artifactId&gt;\r\n    &lt;scope&gt;test&lt;\/scope&gt;\r\n&lt;\/dependency&gt;<\/pre>\n<h3>1.3 Maven \u30d7\u30ed\u30d5\u30a1\u30a4\u30eb<\/h3>\n<p>Maven \u30d7\u30ed\u30d5\u30a1\u30a4\u30eb\u306e\u5b9a\u7fa9\u3002WildFly \u3092\u5148\u306b\u5b9f\u884c\u3055\u305b\u3066\u304a\u3044\u3066\u3001\u30c6\u30b9\u30c8\u6642\u306b\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u30d7\u30ed\u30d5\u30a1\u30a4\u30eb(arq-wildfly-remote) \u3068\u3001WildFly \u505c\u6b62\u72b6\u614b\u304b\u3089\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3059\u308b\u30d7\u30ed\u30d5\u30a1\u30a4\u30eb\u3092(arq-wildfly-managed)\u5b9a\u7fa9\u3059\u308b\u3002<\/p>\n<p>\u3069\u3061\u3089\u3092\u5229\u7528\u3059\u308b\u304b\u306f\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u30e1\u30cb\u30e5\u30fc\u304b\u3089\u3001Maven \u30fc Select Maven Profiles \u3067\u9078\u629e\u3059\u308b\u3002<\/p>\n<pre class=\"prettyprint linenums\">    &lt;profile&gt;\r\n        &lt;!-- The default profile skips all tests, though you can tune it to run \r\n            just unit tests based on a custom pattern --&gt;\r\n        &lt;!-- Seperate profiles are provided for running all tests, including Arquillian \r\n            tests that execute in the specified container --&gt;\r\n        &lt;id&gt;default&lt;\/id&gt;\r\n        &lt;activation&gt;\r\n            &lt;activeByDefault&gt;true&lt;\/activeByDefault&gt;\r\n        &lt;\/activation&gt;\r\n        &lt;build&gt;\r\n            &lt;plugins&gt;\r\n                &lt;plugin&gt;\r\n                    &lt;artifactId&gt;maven-surefire-plugin&lt;\/artifactId&gt;\r\n                    &lt;version&gt;${version.surefire.plugin}&lt;\/version&gt;\r\n                    &lt;configuration&gt;\r\n                        &lt;skip&gt;true&lt;\/skip&gt;\r\n                    &lt;\/configuration&gt;\r\n                &lt;\/plugin&gt;\r\n            &lt;\/plugins&gt;\r\n        &lt;\/build&gt;\r\n    &lt;\/profile&gt;\r\n\r\n    &lt;profile&gt;\r\n        &lt;!-- https:\/\/www.typea.info\/blog\/index.php\/2014\/04\/28\/java_ee_7_1_wildfly_jboss_tools_ear_arquillian --&gt;\r\n        &lt;id&gt;arq-wildfly-managed&lt;\/id&gt;\r\n        &lt;dependencies&gt;\r\n            &lt;dependency&gt;\r\n                &lt;groupId&gt;org.wildfly&lt;\/groupId&gt;\r\n                &lt;artifactId&gt;wildfly-arquillian-container-managed&lt;\/artifactId&gt;\r\n                &lt;version&gt;8.0.0.Final&lt;\/version&gt;\r\n                &lt;scope&gt;test&lt;\/scope&gt;\r\n            &lt;\/dependency&gt;\r\n        &lt;\/dependencies&gt;\r\n    &lt;\/profile&gt;\r\n\r\n    &lt;profile&gt;\r\n        &lt;!-- https:\/\/www.typea.info\/blog\/index.php\/2014\/04\/28\/java_ee_7_1_wildfly_jboss_tools_ear_arquillian --&gt;\r\n        &lt;id&gt;arq-wildfly-remote&lt;\/id&gt;\r\n        &lt;dependencies&gt;\r\n            &lt;dependency&gt;\r\n                &lt;groupId&gt;org.wildfly&lt;\/groupId&gt;\r\n                &lt;artifactId&gt;wildfly-arquillian-container-remote&lt;\/artifactId&gt;\r\n                &lt;version&gt;8.0.0.Final&lt;\/version&gt;\r\n                &lt;scope&gt;test&lt;\/scope&gt;\r\n            &lt;\/dependency&gt;\r\n        &lt;\/dependencies&gt;\r\n    &lt;\/profile&gt;\r\n&lt;\/profiles&gt;<\/pre>\n<h2>2. REST \u30b5\u30fc\u30d3\u30b9<\/h2>\n<p><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2014\/06\/02\/java_ee_7_12_jbatch_arquillian\">\u4f5c\u6210\u3057\u305f\u3001\u30d0\u30c3\u30c1<\/a>\u3092REST\u30b5\u30fc\u30d3\u30b9\u304b\u3089\u547c\u3073\u51fa\u3059\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u3002<\/p>\n<pre class=\"prettyprint linenums\">@Path(\"\/simplejob\")\r\n@RequestScoped\r\npublic class SimpleJobRestService {\r\n    @Inject\r\n    private Logger log;\r\n    \r\n    @GET\r\n    @Produces(MediaType.APPLICATION_JSON)\r\n    public String execute() throws Exception {\r\n        JobOperator jobOperator = BatchRuntime.getJobOperator();\r\n        long executionId = jobOperator.start(\"simplejob\", new Properties());\r\n        \r\n        BufferedReader reader = new BufferedReader(new FileReader(\"c:\\\\work\\\\test_out.txt\"));\r\n        StringBuilder buf = new StringBuilder();\r\n        String line = null;\r\n        while((line = reader.readLine()) != null) {\r\n            buf.append(line).append(\"\\n\");\r\n        }\r\n        return buf.toString();\r\n    }\r\n}<\/pre>\n<h2>3. Arquillian \u306e\u30c6\u30b9\u30c8\u30b1\u30fc\u30b9<\/h2>\n<p>\u30d0\u30c3\u30c1\u3092\u547c\u3073\u51fa\u3059\u3001\u30c6\u30b9\u30c8\u5bfe\u8c61\u306eREST\u30b5\u30fc\u30d3\u30b9\u3092Inject\u3057\u3001\u30c6\u30b9\u30c8\u3059\u308b\u3002<\/p>\n<pre class=\"prettyprint linenums\">@RunWith(Arquillian.class)\r\npublic class SimpleJobRestServiceTest {\r\n    @Deployment\r\n    public static WebArchive createDeployment() {\r\n        WebArchive war = ShrinkWrap.create(WebArchive.class, \"test.war\")\r\n                .addPackage(\"info.typea.tallarico.job.simplejob\")\r\n                .addPackage(\"info.typea.tallarico.rest\")\r\n                .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create(\"beans.xml\"))\r\n                .addAsResource(\"META-INF\/batch-jobs\/simpleJob.xml\")\r\n                .addClasses(Resources.class)\r\n                .addClasses(WebResources.class)\r\n                ;\r\n        System.out.println(war.toString(true));\r\n        return war;\r\n    }\r\n    \r\n    @Inject\r\n    Logger logger;\r\n    \r\n    @Inject\r\n    SimpleJobRestService simpleJobService;\r\n    \r\n    @Test\r\n    public void executeTest() throws Exception {\r\n        assertNotNull(simpleJobService);\r\n        \r\n        logger.info(\"\\n== BATCH REST SERVICE RESULT ==\\n\" \r\n                + simpleJobService.execute());\r\n    }\r\n}<\/pre>\n<h2>4.\u30c6\u30b9\u30c8\u7d50\u679c<\/h2>\n<p>OK\uff01<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/b8f1e3db5549_FE3C\/jbatch_web_result_test.jpg\"><img loading=\"lazy\" decoding=\"async\" title=\"jbatch_web_result_test\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;\" border=\"0\" alt=\"jbatch_web_result_test\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/b8f1e3db5549_FE3C\/jbatch_web_result_test_thumb.jpg\" width=\"382\" height=\"267\" \/><\/a><\/p>\n<\/p>\n<h2>5.\u5b9f\u969b\u306b\u30d0\u30c3\u30c1EAR\u3092\u30c6\u30b9\u30c8\u3059\u308b<\/h2>\n<p>Server \u304b\u3089\u3001WildFly\u3092\u9078\u629e\u3057\u3001\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u30e1\u30cb\u30e5\u30fc Add and Remove \u304b\u3089\u3001\u30d0\u30c3\u30c1EAR\u3092\u8ffd\u52a0\u3059\u308b\u3002<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/b8f1e3db5549_FE3C\/jbatch_web_deploy.jpg\"><img loading=\"lazy\" decoding=\"async\" title=\"jbatch_web_deploy\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;\" border=\"0\" alt=\"jbatch_web_deploy\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/b8f1e3db5549_FE3C\/jbatch_web_deploy_thumb.jpg\" width=\"367\" height=\"282\" \/><\/a><\/p>\n<p>\u8d77\u52d5\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u30a8\u30e9\u30fc\u3002<\/p>\n<pre class=\"prettyprint linenums\">  - Producer Method [Logger] with qualifiers [@Any @Default] declared as [[BackedAnnotatedMethod] @Produces public info.typea.tallarico.util.Resources.produceLog(InjectionPoint)]<\/pre>\n<p>\u305f\u3057\u304b\u306b\u3001\u73fe\u72b6\u3001Logger \u3092\u30a4\u30f3\u30b8\u30a7\u30af\u30b7\u30e7\u30f3\u3057\u305f\u3068\u304d\u306b\u3001EJB\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u542b\u307e\u308c\u308bLogger\u3068\u3001EJB\u30d0\u30c3\u30c1\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u542b\u307e\u308c\u308bLogger\u304c\u66d6\u6627\u306b\u306a\u3063\u3066\u3044\u308b\u3002<\/p>\n<blockquote>\n<p><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2014\/05\/05\/java_ee_4_java_ee_didependency_injection_cdicontexts_and_dependency_injection\">\u7279\u5b9a\u306eBean\u306b\u5bfe\u3057\u3066\u3044\u304f\u3064\u304b\u306e\u5b9f\u88c5\u304c\u63d0\u4f9b\u3055\u308c\u308b\u5834\u5408(\u4f8b\u3048\u3070\u3001\u3042\u308b\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u306b\u5bfe\u3057\u3066\u8907\u6570\u306e\u5b9f\u88c5\u30af\u30e9\u30b9\u304c\u5b58\u5728\u3059\u308b\u5834\u5408)\u3001\u9650\u5b9a\u5b50\u3092\u5229\u7528\u3057\u3066\u3069\u306e\u5b9f\u88c5\u3092\u30a4\u30f3\u30b8\u30a7\u30af\u30c8\u3059\u308b\u306e\u304b\u3092\u7279\u5b9a\u3067\u304d\u308b<\/a><\/p>\n<\/blockquote>\n<p>\u3046\u30fc\u3080\u3002Logger \u3092Produce\u3057\u3066\u304a\u308a\u885d\u7a81\u3057\u3066\u3044\u308b\u3069\u3061\u3089\u304b\u306e\u5b9f\u88c5\u3092\u524a\u9664\u3059\u308c\u3070\u3088\u3044\u306e\u3060\u304c\u3001\u305b\u3063\u304b\u304f\u306a\u306e\u3067\u3001\u9650\u5b9a\u5b50\u3092\u8a66\u3057\u3066\u307f\u308b\u3002<\/p>\n<p>CDI\u95a2\u9023\u306e\u30a8\u30e9\u30fc\u306e\u307b\u3068\u3093\u3069\u306f\u30c7\u30d7\u30ed\u30a4\u6642\u306b\u767a\u751f\u3059\u308b\u3088\u3046\u3060\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001CDI\u306b\u3064\u3044\u3066\u3001\u4ee5\u4e0b\u306e\u30b9\u30e9\u30a4\u30c9\u304c\u308f\u304b\u308a\u3084\u3059\u304b\u3063\u305f\u3002<\/p>\n<p>\n<iframe loading=\"lazy\" width=\"427\" height=\"356\" style=\"margin-bottom: 5px; max-width: 100%; border-top: #ccc 1px solid; height: 276px; border-right: #ccc 1px solid; width: 362px; border-bottom: #ccc 0px solid; border-left: #ccc 1px solid;\" marginheight=\"0\" src=\"http:\/\/www.slideshare.net\/slideshow\/embed_code\/28675109\" frameborder=\"0\" marginwidth=\"0\" scrolling=\"no\" allowfullscreen=\"allowfullscreen\"><\/iframe>\n<\/p>\n<div style=\"margin-bottom: 5px;\"><strong><a title=\"JJUG 11\u6708\u30ca\u30a4\u30c8\u30bb\u30df\u30ca\u30fc CDI\u3092\u306f\u3058\u3081\u3088\u3046\" href=\"https:\/\/www.slideshare.net\/agetsuma\/jjug-11-cdi\" target=\"_blank\">JJUG 11\u6708\u30ca\u30a4\u30c8\u30bb\u30df\u30ca\u30fc CDI\u3092\u306f\u3058\u3081\u3088\u3046<\/a> <\/strong>from <strong><a href=\"http:\/\/www.slideshare.net\/agetsuma\" target=\"_blank\">Norito Agetsuma<\/a><\/strong><\/div>\n<h3> <\/h3>\n<h3>5.1 \u9650\u5b9a\u5b50\u3092\u5229\u7528\u3057\u3066\u307f\u308b<\/h3>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u305b\u3063\u304b\u304f\u306e\u6a5f\u4f1a\u306a\u306e\u3067\u9650\u5b9a\u5b50\u3092\u5229\u7528\u3057\u3066\u307f\u308b\u3002<\/p>\n<h4>\u9650\u5b9a\u5b50\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306e\u5ba3\u8a00<\/h4>\n<pre class=\"prettyprint linenums\">package info.typea.tallarico.job.util;\r\n\r\nimport java.lang.annotation.Retention;\r\nimport java.lang.annotation.RetentionPolicy;\r\n\r\nimport javax.inject.Qualifier;\r\nimport static java.lang.annotation.ElementType.TYPE;\r\nimport static java.lang.annotation.ElementType.METHOD;\r\nimport static java.lang.annotation.ElementType.FIELD;\r\nimport static java.lang.annotation.ElementType.PARAMETER;\r\nimport java.lang.annotation.Target;\r\n\r\n@Qualifier\r\n@Retention(RetentionPolicy.RUNTIME)\r\n@Target({TYPE, METHOD, FIELD, PARAMETER})\r\npublic @interface BatchResource {}<\/pre>\n<h4>Produce \u30e1\u30bd\u30c3\u30c9\u3092\u30a2\u30ce\u30c6\u30fc\u30c8\u3059\u308b<\/h4>\n<pre class=\"prettyprint linenums\">public class Resources {\r\n\r\n    @Produces\r\n    @BatchResource\r\n    public Logger produceLog(InjectionPoint injectionPoint) {\r\n        return Logger.getLogger(injectionPoint.getMember().getDeclaringClass().getName());\r\n    }\r\n}<\/pre>\n<h4>\u30a4\u30f3\u30b8\u30a7\u30af\u30b7\u30e7\u30f3\u7b87\u6240\u3092\u30a2\u30ce\u30c6\u30fc\u30c8\u3059\u308b<\/h4>\n<pre class=\"prettyprint linenums\">    @Inject\r\n    @BatchResource\r\n    Logger logger;<\/pre>\n<p>\u3053\u308c\u3067OK\u306e\u306f\u305a<\/p>\n<h2>6.\u30d6\u30e9\u30a6\u30b6\u304b\u3089REST\u30b5\u30fc\u30d3\u30b9\u3092\u76f4\u63a5\u547c\u3073\u51fa\u3059<\/h2>\n<p>\u30d0\u30c3\u30c1\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u30d1\u30b9\u306f\u3001@ApplicationPath \u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u6307\u5b9a\u3059\u308b\u3002<\/p>\n<pre class=\"prettyprint linenums\">@ApplicationPath(\"\/batch\")\r\npublic class JaxRsActivator extends Application {\r\n    \/* class body intentionally left blank *\/\r\n}<\/pre>\n<p>REST\u30b5\u30fc\u30d3\u30b9\u306eURI\u306f\u3001\u4e0a\u8a18 2.REST\u30b5\u30fc\u30d3\u30b9\u3067\u63b2\u3052\u305f\u30af\u30e9\u30b9\u306e\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u6307\u5b9a\u3002<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/b8f1e3db5549_FE3C\/jbatch_web_success.jpg\"><img loading=\"lazy\" decoding=\"async\" title=\"jbatch_web_success\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;\" border=\"0\" alt=\"jbatch_web_success\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/b8f1e3db5549_FE3C\/jbatch_web_success_thumb.jpg\" width=\"421\" height=\"240\" \/><\/a><\/p>\n<p>OK\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u3001\u30d0\u30c3\u30c1\u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u304c\u51fa\u6765\u305f\uff01\uff01<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u3053\u3053\u307e\u3067\u8a66\u3057\u305f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9<\/p>\n<p><a title=\"https:\/\/github.com\/pppiroto\/Tallarico.git\" href=\"https:\/\/github.com\/pppiroto\/Tallarico.git\">https:\/\/github.com\/pppiroto\/Tallarico.git<\/a><\/p>\n<p>\n<iframe loading=\"lazy\" width=\"320\" height=\"240\" style=\"height: 240px; width: 120px;\" marginheight=\"0\" src=\"http:\/\/rcm-fe.amazon-adsystem.com\/e\/cm?lt1=_blank&amp;bc1=FFFFFF&amp;IS2=1&amp;bg1=FFFFFF&amp;fc1=000000&amp;lc1=0000FF&amp;t=typea09-22&amp;o=9&amp;p=8&amp;l=as4&amp;m=amazon&amp;f=ifr&amp;ref=ss_til&amp;asins=4873115086\" frameborder=\"0\" marginwidth=\"0\" scrolling=\"no\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Java EE 7 \u691c\u8a3c\u74b0\u5883\u69cb\u7bc9(1) WildFly + JBoss Tools \u3067 EAR\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057 Arquillian \u3067 \u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u3092\u30b0\u30ea\u30fc\u30f3\u306b\u3059\u308b\u3068\u3053\u308d\u307e\u3067 Java EE 7 \u691c\u8a3c\u74b0\u5883\u69cb\u7bc9(2 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","footnotes":""},"categories":[69,73,46,74],"tags":[],"class_list":["post-407","post","type-post","status-publish","format-standard","hentry","category-arquillian","category-cdi","category-java-ee","category-jbatch"],"veu_head_title_object":{"title":"","add_site_title":""},"_links":{"self":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/407","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=407"}],"version-history":[{"count":0,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/407\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=407"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=407"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=407"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}