title: How autowired RedisTemplate<String,Long>
body: <p>I want to use RedisTemplate on spring boot.
  I can use StringRedeisTemplate successfully, but  when i cant use RedisTemplate .
  here is the code.</p>
  
  <pre><code>@Service
  public class MyService {
  
      @Autowired
      private RedisTemplate&lt;String, Long&gt; template;
  
      public void execute() {
          template.opsForValue().set("hoge", 1l);
      }
  }
  </code></pre>
  
  <p>But, when start apps, get errors.</p>
  
  <pre><code>&gt; Exception in thread "main"
  &gt; org.springframework.beans.factory.BeanCreationException: Error
  &gt; creating bean with name 'MyService': Injection of autowired
  &gt; dependencies failed; nested exception is
  &gt; org.springframework.beans.factory.BeanCreationException: Could not
  &gt; autowire field: private
  &gt; org.springframework.data.redis.core.RedisTemplate
  &gt; org.hoge.service.MyService.template; nested exception is
  &gt; org.springframework.beans.factory.NoSuchBeanDefinitionException: No
  &gt; qualifying bean of type
  &gt; [org.springframework.data.redis.core.RedisTemplate] found for
  &gt; dependency: expected at least 1 bean which qualifies as autowire
  &gt; candidate for this dependency. Dependency annotations:
  &gt; {@org.springframework.beans.factory.annotation.Autowired(required=true)}
  &gt;   at
  &gt; org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
  &gt;   at
  &gt; org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1202)
  &gt;   at
  &gt; org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
  &gt;   at
  &gt; org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
  &gt;   at
  &gt; org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
  &gt;   at
  &gt; org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
  &gt;   at
  &gt; org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
  &gt;   at
  &gt; org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
  &gt;   at
  &gt; org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:762)
  &gt;   at
  &gt; org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
  &gt;   at
  &gt; org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
  &gt;   at
  &gt; org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109)
  &gt;   at
  &gt; org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
  &gt;   at
  &gt; org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
  &gt;   at
  &gt; org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
  &gt;   at
  &gt; org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
  &gt;   at
  &gt; jp.bizreach.davide.recommend.application.DavimendApplication.main(DavimendApplication.java:11)
  &gt;   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at
  &gt; sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  &gt;   at
  &gt; sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  &gt;   at java.lang.reflect.Method.invoke(Method.java:483)     at
  &gt; com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
  &gt; Caused by: org.springframework.beans.factory.BeanCreationException:
  &gt; Could not autowire field: private
  &gt; org.springframework.data.redis.core.RedisTemplate
  &gt; org.hoge.service.MyService.template; nested exception is
  &gt; org.springframework.beans.factory.NoSuchBeanDefinitionException: No
  &gt; qualifying bean of type
  &gt; [org.springframework.data.redis.core.RedisTemplate] found for
  &gt; dependency: expected at least 1 bean which qualifies as autowire
  &gt; candidate for this dependency. Dependency annotations:
  &gt; {@org.springframework.beans.factory.annotation.Autowired(required=true)}
  &gt;   at
  &gt; org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:558)
  &gt;   at
  &gt; org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
  &gt;   at
  &gt; org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
  &gt;   ... 21 more Caused by:
  &gt; org.springframework.beans.factory.NoSuchBeanDefinitionException: No
  &gt; qualifying bean of type
  &gt; [org.springframework.data.redis.core.RedisTemplate] found for
  &gt; dependency: expected at least 1 bean which qualifies as autowire
  &gt; candidate for this dependency. Dependency annotations:
  &gt; {@org.springframework.beans.factory.annotation.Autowired(required=true)}
  &gt;   at
  &gt; org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1308)
  &gt;   at
  &gt; org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1054)
  &gt;   at
  &gt; org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:949)
  &gt;   at
  &gt; org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:530)
  &gt;   ... 23 more
  </code></pre>