2016-08-05 5 views
-1

Concordionクラスを呼び出すことはできませんテスト-config.xmlのConcordionクラスは、サービスビーンNullPointerExeptionサービス豆NullPointerExeption呼び出すことはできません

<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
    <property name="IgnoreUnresolvablePlaceholders" value="True"></property> 
    <property name="locations"> 
     <list> 
<!--    <value>classpath:test.properties</value> --> 

      <!-- List other property files here --> 
      <!-- value>mail.properties</value --> 
     </list> 
    </property> 
    </bean> 



<bean class="fr.teamnet.spec.UserController"></bean> 
<bean class="fr.teamnet.service.UserServiceImpl"></bean> 
</beans> 

とUserController.java :

@ContextConfiguration(locations = "/test-config.xml") 
public class UserController { 

@Autowired 
UserService userservice; 

public String getPrenom(){ 

    return userservice.findByUserName(); 
} 

} 

問題は:Concordionクラスは、サービスBean NullPointerExeptionを常に呼び出すことができません。SplittingNamesFixtureTestクラス行の :String pren = service.getPrenom();戻り値NullPointerExeption plzzヘルプ

答えて

0

ConcordionはネイティブのSpringサポートを提供しません。 https://github.com/chiknrice/concordion-spring-runnerのようなカスタムコンコードスプリングランナーが必要です。

これは、JUnit 5がサポートされている場合に変更される可能性があります。 http://concordion.org/integrations/java/markdown/#springを参照してください。公共の文字列getPrenom(){ 戻りUserServiceの:私はhttps://github.com/chiknrice/concordion-spring-runner からSpringifiedConcordionRunnerを使用するが、私は私のコントローラからのサービスBeanを呼び出すときに私はnullPointerExeptionを持っているとき

+0

それは仕事です。 findByUserName(); } userservice beanがnullです – HMI

+0

私はどこに問題があるのか​​わかりません。どんな考えがありますか? – HMI

+0

私はtest-config.xmlにseviceBeanを宣言してこの問題を解決しました – HMI

関連する問題