0
util 클래스에서 내 서비스 중 하나를 사용하고 싶습니다. 이제이 서비스는 유선이지만 유틸리티는 그렇지 않습니다.빈 배선 (자동 종속 종속성 있음) : 변환 실패
<bean id="userServiceWired" class="com.daniels.jack.service.userServiceImpl">
<property name="restTemplate" value="restTemplateWired" />
</bean>
<bean id="restTemplateWired" class="org.springframework.web.client.RestTemplate"/>
하지만 내가 얻을 : 내가 내의 context.xml에서
ApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"context.xml"});
UserService userService = (UserService) ((BeanFactory)context).getBean("userServiceWired");
을 내 백분율 클래스 그래서
내가 할
의 속성 값을 변환하는 데 실패 'java.lang.String'을 필수 유형 'org.springframework.web.client.RestTemplate'로 입력하십시오.
UserService userService = ...
줄에. 대신 값의
참고 : 코드의 두 번째 라인을 단순화 할 수 있습니다 단지'UserService userService = context.getBean ("userServiceWired", UserService.class); ' – skaffman