在Spring Boot中创建在类路径资源中定义的名称为'redisson'的bean时出错

尼罗什·玛达克

在将Redis(“使用Redisson”)与Spring Boot连接时,我遇到一些问题。应用时,开始时间显示以下错误。

“ org.springframework.beans.factory.BeanCreationException:在类路径资源[com / redisson / config / RedisConfig.class]中创建名称为'redisson'的bean时出错:通过工厂方法实例化的bean失败;嵌套异常是org.springframework。 beans.BeanInstantiationException:无法实例化[org.redisson.api.RedissonClient]:工厂方法'redisson'抛出异常;嵌套的异常是java.lang.IllegalArgumentException:方案名称中索引0的非法字符:127.0.0.1:6379“

我的代码仅在春季@Bean中进行连接

package com.redisson.config;
> 
> import java.io.IOException;
> 
> import org.redisson.Redisson; import org.redisson.api.RedissonClient;
> import org.redisson.config.Config; import
> org.springframework.beans.factory.annotation.Value; import
> org.springframework.context.annotation.Bean; import
> org.springframework.context.annotation.ComponentScan; import
> org.springframework.context.annotation.Configuration;
> 
> @Configuration @ComponentScan({"com.redisson.config"}) public class
> RedisConfig {
> 
>   @Value("${spring.redis.url}")   String REDIS_URL;   
>   @Bean(destroyMethod="shutdown")
>     RedissonClient redisson() throws IOException {        System.out.println("Redis url"+REDIS_URL);
>         Config config = new Config();
>         //config.useClusterServers().addNodeAddress("127.0.0.1:6379");
>         config.useSingleServer().setAddress("127.0.0.1:6379");
>         return Redisson.create(config);
>     }
> 
> }
亚历山大·波洛佐夫(Alexander Polozov)

java.net.URI例外。如果您使用的是非法地址格式,请尝试将其更改为"redis://127.0.0.1:6379"我猜应该可以解决您的问题。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

使用Spring Boot时在类路径资源中定义名称为'entityManagerFactory'的bean创建时出错

创建在类路径资源[mybatis-spring.xml]中定义的名称为'sqlSessionFactory'的bean时出错:

Spring Java Config错误创建在类路径资源中定义名称为“ entityManagerFactory”的bean

Spring Boot:+ Spring Data Rest:在类路径资源中定义名称为“entityManagerFactory”的 bean 创建时出错

Spring Boot-在类路径资源中创建名称为'dataSource'的bean时出错

运行spring boot build:在类路径中创建名称为'entityManagerFactory'的bean时出错

创建在类路径资源+ Springboot中定义的名称为“ dataSource”的bean时出错

创建在类路径资源中定义的名称为“ googleCredentials”的bean时出错

创建在类路径资源中定义的名称为“ tilesConfigurer”的bean时出错[使用shopizer的知识]

在Spring Boot中创建名称为'batchConfigurer'的bean时出错

创建在类路径资源中定义的名称为'entityManagerFactory'的bean时出错-SO的解决方案不起作用

创建在类路径资源[application-context.xml]中定义的名称为'sesssionFactory'的bean时出错

创建文件 Spring Boot 中定义的名称为“postsController”的 bean 时出错

创建在类路径中定义的名称为'entityManagerFactory'的bean时出错

我为我的Spring Boot应用程序获取了“在类路径资源中定义名称为'requestMappingHandlerAdapter'的bean创建错误”

在 ServletContext 资源 [/WEB-INF/spring/applicationContext.xml] 中定义名称为“entityManagerFactory”的 bean 创建时出错:

春季:创建类路径资源中定义的名称为'entityManagerFactory'的bean时出错

春季靴子| 创建类路径资源中定义的名称为'entityManagerFactory'的bean时出错

Spring Boot-创建名称为'jmsConnectionFactory'的bean时出错

Spring Boot错误:创建名称为“ entityManagerFactory”的bean时出错

创建在类路径资源中定义的名称为'entityManagerFactory'的bean时出错:模式验证:缺少表[association_value_entry]

在Spring Boot App中创建名称为'liquibase'的bean时出错

创建在ServletContext资源中定义的名称为'emf'的bean时出错

Spring MVC:使用在ServletContext资源中定义的名称“HandlerMapping”创建bean时出错

在Spring中创建bean时出错

从依赖项创建在类路径资源[rabbit-context.xml]中定义的Bean时出错

测试Spring时创建bean时出错

Spring Boot异常,创建bean时出错

如何解决“在类路径资源中创建名称为'entityManagerFactory'的bean时出错”