Spring boot start Times error

 /\\ / ___"_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | "_ | "_| | "_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  "  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.0.2.RELEASE)

2018-05-30 10:03:51.252  INFO 6448 --- [  restartedMain] com.example.DemoApplication              : Starting DemoApplication on huyh-PC with PID 6448 (D:\work\springbootspace\demo\target\classes started by huyh in D:\work\springbootspace\demo)
2018-05-30 10:03:51.254  INFO 6448 --- [  restartedMain] com.example.DemoApplication              : No active profile set, falling back to default profiles: default
2018-05-30 10:03:51.775  INFO 6448 --- [  restartedMain] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@5d4441ea: startup date [Wed May 30 10:03:51 CST 2018]; root of context hierarchy
2018-05-30 10:03:53.404  WARN 6448 --- [  restartedMain] o.m.s.mapper.ClassPathMapperScanner      : No MyBatis mapper was found in "[com.example]" package. Please check your configuration.
2018-05-30 10:03:53.509  INFO 6448 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2018-05-30 10:03:54.092  INFO 6448 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean "org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration" of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$5cc6f725] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-05-30 10:03:54.107  INFO 6448 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean "org.springframework.cache.annotation.ProxyCachingConfiguration" of type [org.springframework.cache.annotation.ProxyCachingConfiguration$$EnhancerBySpringCGLIB$$a5d92d43] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-05-30 10:03:54.840  INFO 6448 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2018-05-30 10:03:54.885  INFO 6448 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2018-05-30 10:03:54.885  INFO 6448 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.31
2018-05-30 10:03:54.890  INFO 6448 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener   : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [D:\work\JDK\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\work\JDK\bin;D:\work\SVN\bin;C:\Program Files (x86)\Git\cmd;%TOMCAT_HOME%\bin;D:\work\tomcat7\lib;D:\work\JDK\bin;D:\work\JDK\jre\bin;.]
2018-05-30 10:03:55.634  INFO 6448 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2018-05-30 10:03:55.634  INFO 6448 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 3864 ms
2018-05-30 10:03:56.250  INFO 6448 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Servlet dispatcherServlet mapped to [/]
2018-05-30 10:03:56.259  INFO 6448 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: "characterEncodingFilter" to: [/*]
2018-05-30 10:03:56.260  INFO 6448 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: "hiddenHttpMethodFilter" to: [/*]
2018-05-30 10:03:56.261  INFO 6448 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: "httpPutFormContentFilter" to: [/*]
2018-05-30 10:03:56.262  INFO 6448 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: "requestContextFilter" to: [/*]
Logging initialized using "class org.apache.ibatis.logging.stdout.StdOutImpl" adapter.
2018-05-30 10:03:56.854  WARN 6448 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name "redisCacheTransfer": Unsatisfied dependency expressed through method "setJedisConnectionFactory" parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type "org.springframework.data.redis.connection.jedis.JedisConnectionFactory" available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
2018-05-30 10:03:56.869  INFO 6448 --- [  restartedMain] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2018-05-30 10:03:56.885  INFO 6448 --- [  restartedMain] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with "debug" enabled.
2018-05-30 10:03:57.077 ERROR 6448 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of method setJedisConnectionFactory in com.example.Utils.cache.RedisCacheTransfer required a bean of type "org.springframework.data.redis.connection.jedis.JedisConnectionFactory" that could not be found.
    - Bean method "redisConnectionFactory" in "JedisConnectionConfiguration" not loaded because @ConditionalOnMissingBean (types: org.springframework.data.redis.connection.RedisConnectionFactory; SearchStrategy: all) found beans of type "org.springframework.data.redis.connection.RedisConnectionFactory" redisConnectionFactory


Action:

Consider revisiting the conditions above or defining a bean of type "org.springframework.data.redis.connection.jedis.JedisConnectionFactory" in your configuration.


Process finished with exit code 0

when I first contacted spring boot, I did it according to the above example when I used redis for secondary cache. As a result, I reported this error when I started!
pom dependency

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
            <version>2.0.2.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
        </dependency>

then the following is application

-sharpredis
spring.redis.database=1
spring.redis.host=127.0.0.1
spring.redis.port=6379
spring.redis.password=
spring.redis.pool.max-idle=8
spring.redis.pool.min-idle=0
spring.redis.pool.max-active=8
spring.redis.pool.max-wait=-1
spring.redis.timeout=50000
-sharp
mybatis.mapperLocations=classpath:mappers/*.xml
mybatis.type-aliases-package= com.example.entity
mybatis.config-location= classpath:mybatis-config.xml

-sharp *
mybatis.cacheEnabled=true
-sharp
mybatis.lazyLoadingEnabled=false
-sharpSQL
mybatis.multipleResultSetsEnabled=true
-sharp(SQL )
mybatis.aggressiveLazyLoading=true

-sharppagehelper
pagehelper.helperDialect=mysql
pagehelper.reasonable=true
pagehelper.supportMethodsArguments=true
pagehelper.params=count=countSql

spring.datasource.url = jdbc:mysql://localhost:3306/exam
spring.datasource.username = root
spring.datasource.password = root
spring.datasource.driverClassName =com.mysql.jdbc.Driver
spring.datasource.max-active=20
spring.datasource.max-idle=8
spring.datasource.min-idle=8
spring.datasource.initial-size=10

error class


@Component
public class RedisCacheTransfer {

    @Autowired
    public void setJedisConnectionFactory(JedisConnectionFactory jedisConnectionFactory) {
        MybatisRedisCache.setJedisConnectionFactory(jedisConnectionFactory);
    }

}

and then this is the error when it starts

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of method setJedisConnectionFactory in com.example.Utils.cache.RedisCacheTransfer required a bean of type "org.springframework.data.redis.connection.jedis.JedisConnectionFactory" that could not be found.
    - Bean method "redisConnectionFactory" in "JedisConnectionConfiguration" not loaded because @ConditionalOnMissingBean (types: org.springframework.data.redis.connection.RedisConnectionFactory; SearchStrategy: all) found beans of type "org.springframework.data.redis.connection.RedisConnectionFactory" redisConnectionFactory


Action:

Consider revisiting the conditions above or defining a bean of type "org.springframework.data.redis.connection.jedis.JedisConnectionFactory" in your configuration.


Process finished with exit code 0

I don"t know if what I posted is enough for bosses to analyze the problem. If I want to see where I want to see it, I can post it again

.
Apr.03,2021

the reason, as @ Meow said, is that Spring-boot 2.0 uses redis client by default: lettuce

< H2 > solution < / H2 >

want to try lettuce:

replace JedisConnectionFactory dependencies with org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory or org.springframework.data.redis.connection.RedisConnectionFactory

recommend the latter. it is an interface implemented by both JedisConnectionFactory and LettuceConnectionFactory. The advantage is that when you want to change the redis client, you can only change the project dependency without moving the Java code

.

want to change to jedis:

exclude lettuce dependencies and introduce jedis

  

error prompt: cannot find bean, of type org.springframework.data.redis.connection.jedis.JedisConnectionFactory
in your @ Configuration configuration class, use @ Bean to register such a bean first

Menu