{"id":662,"date":"2019-02-04T00:32:31","date_gmt":"2019-02-03T15:32:31","guid":{"rendered":"https:\/\/ito-u-oti.com\/?p=662"},"modified":"2019-02-04T00:32:31","modified_gmt":"2019-02-03T15:32:31","slug":"post-662","status":"publish","type":"post","link":"https:\/\/ito-u-oti.com\/?p=662","title":{"rendered":"@Scope(&#8220;step&#8221;)\u306e\u30c6\u30b9\u30c8\u3067\u30a8\u30e9\u30fc\uff08No Scope registered for scope name &#8216;step&#8217;\uff09"},"content":{"rendered":"<h2 id=\"outline__1\">\u4e8b\u8c61<\/h2>\n<p>@Scope(&#8220;step&#8221;)\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u304c\u4ed8\u4e0e\u3055\u308c\u3066\u3044\u308b\u30af\u30e9\u30b9\u306b\u5bfe\u3057\u3066Junit\u306b\u3088\u308bSpringJUnit4ClassRunner\u30c6\u30b9\u30c8\u3092\u4f5c\u6210\u3057\u5b9f\u884c\u3057\u305f\u3068\u3053\u308d\u30a8\u30e9\u30fc\u304c\u767a\u751f<br \/>\n\u30c6\u30b9\u30c8\u7528\u306exml\u3092\u4f5c\u6210\u3057\u3001@ContextConfiguration\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u8a2d\u5b9a\u3057\u3066\u3044\u305f\u3002<\/p>\n<h2 id=\"outline__2\">\u30a8\u30e9\u30fc\u5185\u5bb9<\/h2>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&#x5B;2018\/11\/19 09:46:39] &#x5B;main] &#x5B;o.s.t.c.TestContextManager] &#x5B;ERROR] Caught exception while allowing TestExecutionListener &#x5B;org.springframework.test.context.support.DependencyInjectionTestExecutionListener@6d3af739] to prepare test instance &#x5B;jp.co.nttdata.shinkin.service.sharedService.ConvertToYYYYMMddToAD.SharedService_ConvertToYYYYMMddToADTest@3569edd5]\r\njava.lang.IllegalStateException: Failed to load ApplicationContext\r\n\tat org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124)\r\n\tat org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83)\r\n\tat org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117)\r\n\tat org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)\r\n\tat org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230)\r\n\tat org.springframework.test.context.junit4.statements.RunPrepareTestInstanceCallbacks.evaluate(RunPrepareTestInstanceCallbacks.java:63)\r\n\tat org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)\r\n\tat org.springframework.test.context.junit4.statements.SpringFailOnTimeout.evaluate(SpringFailOnTimeout.java:87)\r\n\tat org.springframework.test.context.junit4.statements.ProfileValueChecker.evaluate(ProfileValueChecker.java:101)\r\n\tat org.junit.experimental.theories.Theories$TheoryAnchor$1$1.evaluate(Theories.java:232)\r\n\tat org.junit.experimental.theories.Theories$TheoryAnchor.runWithCompleteAssignment(Theories.java:218)\r\n\tat org.junit.experimental.theories.Theories$TheoryAnchor.runWithAssignment(Theories.java:204)\r\n\tat org.junit.experimental.theories.Theories$TheoryAnchor.runWithIncompleteAssignment(Theories.java:212)\r\n\tat org.junit.experimental.theories.Theories$TheoryAnchor.runWithAssignment(Theories.java:202)\r\n\tat org.junit.experimental.theories.Theories$TheoryAnchor.evaluate(Theories.java:187)\r\n\tat org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)\r\n\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)\r\n\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)\r\n\tat org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)\r\n\tat org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)\r\n\tat org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)\r\n\tat org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)\r\n\tat org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)\r\n\tat org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)\r\n\tat org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)\r\n\tat org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)\r\n\tat org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)\r\n\tat org.springframework.test.context.junit4.statements.ProfileValueChecker.evaluate(ProfileValueChecker.java:101)\r\n\tat org.springframework.test.context.junit4.rules.SpringClassRule$TestContextManagerCacheEvictor.evaluate(SpringClassRule.java:242)\r\n\tat org.junit.rules.RunRules.evaluate(RunRules.java:20)\r\n\tat org.junit.runners.ParentRunner.run(ParentRunner.java:363)\r\n\tat org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)\r\n\tat org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)\r\n\tat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)\r\n\tat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)\r\n\tat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)\r\n\tat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)\r\nCaused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hogeServiceImpl': Injection of autowired dependencies failed; nested exception is java.lang.IllegalStateException: No Scope registered for scope name 'step'\r\n\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:372)\r\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1225)\r\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:552)\r\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)\r\n\tat org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)\r\n\tat org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)\r\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)\r\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)\r\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:759)\r\n\tat org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)\r\n\tat org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)\r\n\tat org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:128)\r\n\tat org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60)\r\n\tat org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:108)\r\n\tat org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:251)\r\n\tat org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98)\r\n\tat org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116)\r\n\t... 36 common frames omitted\r\nCaused by: java.lang.IllegalStateException: No Scope registered for scope name 'step'\r\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:337)\r\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)\r\n\tat org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:207)\r\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1136)\r\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1064)\r\n\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585)\r\n\tat org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)\r\n\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366)\r\n\t... 52 common frames omitted\r\n<\/pre>\n<h2 id=\"outline__3\">\u539f\u56e0<\/h2>\n<p>step\u30af\u30e9\u30b9\u304c\u306a\u3044\u305f\u3081\u3002<\/p>\n<h2 id=\"outline__4\">\u89e3\u6c7a\u7b56<\/h2>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&lt;bean class=&quot;org.springframework.batch.core.scope.StepScope&quot; \/&gt;\r\n<\/pre>\n<p>\u3092applicationContext.xml\u306b\u8ffd\u52a0\u3057\u305f<\/p>\n<h2 id=\"outline__5\">\u53c2\u8003<\/h2>\n<p><a href=\"https:\/\/stackoverflow.com\/questions\/22108315\/how-can-i-configure-spring-batch-stepscope-using-java-based-configuration\">How can I configure Spring Batch StepScope using java-based configuration?<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e8b\u8c61 @Scope(&#8220;step&#8221;)\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u304c\u4ed8\u4e0e\u3055\u308c\u3066\u3044\u308b\u30af\u30e9\u30b9\u306b\u5bfe\u3057 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":93,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[154,11,149],"class_list":["post-662","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-error-bugs","tag-scope","tag-junit","tag-spring-batch"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts\/662","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=662"}],"version-history":[{"count":1,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts\/662\/revisions"}],"predecessor-version":[{"id":663,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts\/662\/revisions\/663"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/media\/93"}],"wp:attachment":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=662"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=662"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=662"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}