Consider defining a bean of type org.springframework.data.redis.connection.RedisConnectionFactory

Consider defining a bean of type ‘org.springframework.data.redis.core.RedisTemplate’ in your configuration
代码如下:
在这里插入图片描述
springboot 整合redis是爆出的错误,找不到RedisTemplate 配置
解决方法:
1、检查依赖是否导入

    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-redis</artifactId>
    </dependency>
    <dependency>
        <groupId>redis.clients</groupId>
        <artifactId>jedis</artifactId>
    </dependency>

2.检查是否配置了属性文件

   	 host: 127.0.01
     port: 6379
     password:
     database: 0
     如果没有配置redis会调用默认的配置

3.如果以上两步还没有解决问题
尝试把注解修改成@Resource
@Resource
private RedisTemplate<String, Object> redisTemplate;

4.如果还没有解决问题
尝试修改下pom.xml 中 springboot的版本

org.springframework.boot
spring-boot-starter-parent
1.5.17.RELEASE

以上解决方式仅供参考,如果有更好的解决方式 可以留言

  • 5
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
D3.js 4.x Data Visualization - Third Edition by Andrew Rininsland English | 28 Apr. 2017 | ASIN: B01MG90SSJ | 308 Pages | AZW3 | 6.6 MB Key Features Build interactive and rich graphics and visualization using JavaScript`s powerful library D3.js Learn D3 from the ground up, using the all-new version 4 of the library Gain insight into producing high-quality, extensible charts and visualizations using best practices such as writing testable, extensible code and strong typing Book Description Want to get started with impressive interactive visualizations and implement them in your daily tasks? This book offers the perfect solution-D3.js. It has emerged as the most popular tool for data visualization. This book will teach you how to implement the features of the latest version of D3 while writing JavaScript using the newest tools and technique You will start by setting up the D3 environment and making your first basic bar chart. You will then build stunning SVG and Canvas-based data visualizations while writing testable, extensible code,as accurate and informative as it is visually stimulating. Step-by-step examples walk you through creating, integrating, and debugging different types of visualization and will have you building basic visualizations (such as bar, line, and scatter graphs) in no time. By the end of this book, you will have mastered the techniques necessary to successfully visualize data and will be ready to use D3 to transform any data into an engaging and sophisticated visualization. What you will learn Map data to visual elements using D3's scales Draw SVG elements using D3's shape generators Transform data using D3's collection methods Use D3's various layout patterns to quickly generate various common types of chart Write modern JavaScript using ES2017 and Babel Explore the basics of unit testing D3 visualizations using Mocha and Chai Write and deploy a simple Node.js web service to render charts via HTML Canvas Understand what makes a good data visualization and how to use the tools at your disposal to create accurate charts About the Author Andrew Rininsland is a developer and journalist who has spent much of the last half a decade building interactive content for newspapers such as The Financial Times, The Times, Sunday Times, The Economist, and The Guardian. During his 3 years at The Times and Sunday Times, he worked on all kinds of editorial projects, ranging from obituaries of figures such as Nelson Mandela to high-profile, data-driven investigations such as The Doping Scandal the largest leak of sporting blood test data in history. He is currently a senior developer with the interactive graphics team at the Financial Times. Swizec Teller, author of Data Visualization with d3.js, is a geek with a hat. He founded his first start-up at the age of 21 years and is now looking for the next big idea as a full-stack Web generalist focusing on freelancing for early-stage start-up companies. When he isn't coding, he's usually blogging, writing books, or giving talks at various non-conference events in Slovenia and nearby countries. He is still looking for a chance to speak at a big international conference. In November 2012, he started writing Why Programmers Work At Night, and set out on a quest to improve the lives of developers everywhere. Table of Contents Getting Started with D3, ES2017, and Node.js A Primer on DOM, SVG, and CSS Shape Primitives of D3 Making Data Useful Defining the User Experience - Animation and Interaction Hierarchical Layouts of D3 The Other Layouts D3 on the Server with Canvas, Koa 2, and Node.js Having Confidence in Your Visualizations Designing Good Data Visualizations
This book explores the concept of a map as a fundamental data type. It defines maps at three levels. The first is an abstract level, in which mathematic concepts are leveraged to precisely explain maps and operational semantics. The second is at a discrete level, in which graph theory is used to create a data model with the goal of implementation in computer systems. Finally, maps are examined at an implementation level, in which the authors discuss the implementation of a fundamental map data type in database systems. The map data type presented in this book creates new mechanisms for the storage, analysis, and computation of map data objects in any field that represents data in a map form. The authors develop a model that includes a map data type capable of representing thematic and geometric attributes in a single data object. The book provides a complete example of mathematically defining a data type, ensuring closure properties of those operations, and then translating that type into a state that is suited for implementation in a particular context. The book is designed for researchers and professionals working in geography or computer science in a range of fields including navigation, reasoning, robotics, geospatial analysis, data management, and information retrieval. Table of Contents Chapter 1 Concepts of Maps Chapter 2 A Formal Model of Maps as a Fundamental Type Chapter 3 PLR Partitions: Extending Maps to Include Point and Line Features Chapter 4 Foundational Operations for Maps Chapter 5 Constructing Map Operations Using the Fundamental Map Operations Chapter 6 Extended Operations Over Maps Chapter 7 Topological Relationships Between Maps Chapter 8 A Discrete Model of Maps Chapter 9 Implementing Maps: Map2D
Table of Contents Copyright Brief Table of Contents Table of Contents Praise for the Third Edition of Spring in Action Preface Acknowledgments About this Book 1. Core Spring Chapter 1. Springing into action 1.1. Simplifying Java development 1.1.1. Unleashing the power of POJOs 1.1.2. Injecting dependencies 1.1.3. Applying aspects 1.1.4. Eliminating boilerplate code with templates 1.2. Containing your beans 1.2.1. Working with an application context 1.2.2. A bean’s life 1.3. Surveying the Spring landscape 1.3.1. Spring modules 1.3.2. The Spring portfolio 1.4. What’s new in Spring 1.4.1. What was new in Spring 3.1? 1.4.2. What was new in Spring 3.2? 1.4.3. What’s new in Spring 4.0? 1.5. Summary Chapter 2. Wiring beans 2.1. Exploring Spring’s configuration options 2.2. Automatically wiring beans 2.2.1. Creating discoverable beans 2.2.2. Naming a component-scanned bean 2.2.3. Setting a base package for component scanning 2.2.4. Annotating beans to be automatically wired 2.2.5. Verifying automatic configuration 2.3. Wiring beans with Java 2.3.1. Creating a configuration class 2.3.2. Declaring a simple bean 2.3.3. Injecting with JavaConfig 2.4. Wiring beans with XML 2.4.1. Creating an XML configuration specification 2.4.2. Declaring a simple <bean> 2.4.3. Initializing a bean with constructor injection 2.4.4. Setting properties 2.5. Importing and mixing configurations 2.5.1. Referencing XML configuration in JavaConfig 2.5.2. Referencing JavaConfig in XML configuration 2.6. Summary Chapter 3. Advanced wiring 3.1. Environments and profiles 3.1.1. Configuring profile beans 3.1.2. Activating profiles 3.2. Conditional beans 3.3. Addressing ambiguity in autowiring 3.3.1. Designating a primary bean 3.3.2. Qualifying autowired beans 3.4. Scoping beans 3.4.1. Working with request and session scope 3.4.2. Declaring scoped proxies in XML 3.5. Runtime value injection 3.5.1. Injecting external values 3.5.2. Wiring with the Spring Expression Language 3.6. Summary Chapter 4. Aspect-oriented Spring 4.1. What is aspect-oriented programming? 4.1.1. Defining AOP terminology 4.1.2. Spring’s AOP support 4.2. Selecting join points with pointcuts 4.2.1. Writing pointcuts 4.2.2. Selecting beans in pointcuts 4.3. Creating annotated aspects 4.3.1. Defining an aspect 4.3.2. Creating around advice 4.3.3. Handling parameters in advice 4.3.4. Annotating introductions 4.4. Declaring aspects in XML 4.4.1. Declaring before and after advice 4.4.2. Declaring around advice 4.4.3. Passing parameters to advice 4.4.4. Introducing new functionality with aspects 4.5. Injecting AspectJ aspects 4.6. Summary 2. Spring on the web Chapter 5. Building Spring web applications 5.1. Getting started with Spring MVC 5.1.1. Following the life of a request 5.1.2. Setting up Spring MVC 5.1.3. Introducing the Spittr application 5.2. Writing a simple controller 5.2.1. Testing the controller 5.2.2. Defining class-level request handling 5.2.3. Passing model data to the view 5.3. Accepting request input 5.3.1. Taking query parameters 5.3.2. Taking input via path parameters 5.4. Processing forms 5.4.1. Writing a form-handling controller 5.4.2. Validating forms 5.5. Summary Chapter 6. Rendering web views 6.1. Understanding view resolution 6.2. Creating JSP views 6.2.1. Configuring a JSP-ready view resolver 6.2.2. Using Spring’s JSP libraries 6.3. Defining a layout with Apache Tiles views 6.3.1. Configuring a Tiles view resolver 6.4. Working with Thymeleaf 6.4.1. Configuring a Thymeleaf view resolver 6.4.2. Defining Thymeleaf templates 6.5. Summary Chapter 7. Advanced Spring MVC 7.1. Alternate Spring MVC configuration 7.1.1. Customizing DispatcherServlet configuration 7.1.2. Adding additional servlets and filters 7.1.3. Declaring DispatcherServlet in web.xml 7.2. Processing multipart form data 7.2.1. Configuring a multipart resolver 7.2.2. Handling multipart requests 7.3. Handling exceptions 7.3.1. Mapping exceptions to HTTP status codes 7.3.2. Writing exception-handling methods 7.4. Advising controllers 7.5. Carrying data across redirect requests 7.5.1. Redirecting with URL templates 7.5.2. Working with flash attributes 7.6. Summary Chapter 8. Working with Spring Web Flow 8.1. Configuring Web Flow in Spring 8.1.1. Wiring a flow executor 8.1.2. Configuring a flow registry 8.1.3. Handling flow requests 8.2. The components of a flow 8.2.1. States 8.2.2. Transitions 8.2.3. Flow data 8.3. Putting it all together: the pizza flow 8.3.1. Defining the base flow 8.3.2. Collecting customer information 8.3.3. Building an order 8.3.4. Taking payment 8.4. Securing web flows 8.5. Summary Chapter 9. Securing web applications 9.1. Getting started with Spring Security 9.1.1. Understanding Spring Security modules 9.1.2. Filtering web requests 9.1.3. Writing a simple security configuration 9.2. Selecting user details services 9.2.1. Working with an in-memory user store 9.2.2. Authenticating against database tables 9.2.3. Applying LDAP-backed authentication 9.2.4. Configuring a custom user service 9.3. Intercepting requests 9.3.1. Securing with Spring Expressions 9.3.2. Enforcing channel security 9.3.3. Preventing cross-site request forgery 9.4. Authenticating users 9.4.1. Adding a custom login page 9.4.2. Enabling HTTP Basic authentication 9.4.3. Enabling remember-me functionality 9.4.4. Logging out 9.5. Securing the view 9.5.1. Using Spring Security’s JSP tag library 9.5.2. Working with Thymeleaf’s Spring Security dialect 9.6. Summary 3. Spring in the back end Chapter 10. Hitting the database with Spring and JDBC 10.1. Learning Spring’s data-access philosophy 10.1.1. Getting to know Spring’s data-access exception hierarchy 10.1.2. Templating data access 10.2. Configuring a data source 10.2.1. Using JNDI data sources 10.2.2. Using a pooled data source 10.2.3. Using JDBC driver-based data sources 10.2.4. Using an embedded data source 10.2.5. Using profiles to select a data source 10.3. Using JDBC with Spring 10.3.1. Tackling runaway JDBC code 10.3.2. Working with JDBC templates 10.4. Summary Chapter 11. Persisting data with object-relational mapping 11.1. Integrating Hibernate with Spring 11.1.1. Declaring a Hibernate session factory 11.1.2. Building Spring-free Hibernate 11.2. Spring and the Java Persistence API 11.2.1. Configuring an entity manager factory 11.2.2. Writing a JPA-based repository 11.3. Automatic JPA repositories with Spring Data 11.3.1. Defining query methods 11.3.2. Declaring custom queries 11.3.3. Mixing in custom functionality 11.4. Summary Chapter 12. Working with NoSQL databases 12.1. Persisting documents with MongoDB 12.1.1. Enabling MongoDB 12.1.2. Annotating model types for MongoDB persistence 12.1.3. Accessing MongoDB with MongoTemplate 12.1.4. Writing a MongoDB repository 12.2. Working with graph data in Neo4j 12.2.1. Configuring Spring Data Neo4j 12.2.2. Annotating graph entities 12.2.3. Working with Neo4jTemplate 12.2.4. Creating automatic Neo4j repositories 12.3. Working with key-value data in Redis 12.3.1. Connecting to Redis 12.3.2. Working with RedisTemplate 12.3.3. Setting key and value serializers 12.4. Summary Chapter 13. Caching data 13.1. Enabling cache support 13.1.1. Configuring a cache manager 13.2. Annotating methods for caching 13.2.1. Populating the cache 13.2.2. Removing cache entries 13.3. Declaring caching in XML 13.4. Summary Chapter 14. Securing methods 14.1. Securing methods with annotations 14.1.1. Restricting method access with @Secured 14.1.2. Using JSR-250’s @RolesAllowed with Spring Security 14.2. Using expressions for method-level security 14.2.1. Expressing method access rules 14.2.2. Filtering method inputs and outputs 14.3. Summary 4. Integrating Spring Chapter 15. Working with remote services 15.1. An overview of Spring remoting 15.2. Working with RMI 15.2.1. Exporting an RMI service 15.2.2. Wiring an RMI service 15.3. Exposing remote services with Hessian and Burlap 15.3.1. Exposing bean functionality with Hessian/Burlap 15.3.2. Accessing Hessian/Burlap services 15.4. Using Spring’s HttpInvoker 15.4.1. Exposing beans as HTTP services 15.4.2. Accessing services via HTTP 15.5. Publishing and consuming web services 15.5.1. Creating Spring-enabled JAX-WS endpoints 15.5.2. Proxying JAX-WS services on the client side 15.6. Summary Chapter 16. Creating REST APIs with Spring MVC 16.1. Getting REST 16.1.1. The fundamentals of REST 16.1.2. How Spring supports REST 16.2. Creating your first REST endpoint 16.2.1. Negotiating resource representation 16.2.2. Working with HTTP message converters 16.3. Serving more than resources 16.3.1. Communicating errors to the client 16.3.2. Setting headers in the response 16.4. Consuming REST resources 16.4.1. Exploring RestTemplate’s operations 16.4.2. GETting resources 16.4.3. Retrieving resources 16.4.4. Extracting response metadata 16.4.5. PUTting resources 16.4.6. DELETEing resources 16.4.7. POSTing resource data 16.4.8. Receiving object responses from POST requests 16.4.9. Receiving a resource location after a POST request 16.4.10. Exchanging resources 16.5. Summary Chapter 17. Messaging in Spring 17.1. A brief introduction to asynchronous messaging 17.1.1. Sending messages 17.1.2. Assessing the benefits of asynchronous messaging 17.2. Sending messages with JMS 17.2.1. Setting up a message broker in Spring 17.2.2. Using Spring’s JMS template 17.2.3. Creating message-driven POJOs 17.2.4. Using message-based RPC 17.3. Messaging with AMQP 17.3.1. A brief introduction to AMQP 17.3.2. Configuring Spring for AMQP messaging 17.3.3. Sending messages with RabbitTemplate 17.3.4. Receiving AMQP messages
To define a bean of type 'org.springframework.data.redis.connection.RedisConnectionFactory' in your configuration, you can follow these steps: 1. Make sure you have the necessary dependencies added to your project. For Redis, you will need the following dependencies in your Maven or Gradle configuration: - For Maven: ```xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> ``` - For Gradle: ```gradle implementation 'org.springframework.boot:spring-boot-starter-data-redis' ``` 2. Create a Redis configuration class. This class should be annotated with `@Configuration` and `@EnableRedisRepositories`. 3. Within the configuration class, define a bean of type `RedisConnectionFactory`. You can do this by using the `LettuceConnectionFactory` class provided by Spring Data Redis. Here's an example: ```java import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; @Configuration @EnableRedisRepositories public class RedisConfig { @Value("${spring.redis.host}") private String redisHost; @Value("${spring.redis.port}") private int redisPort; @Bean public RedisConnectionFactory redisConnectionFactory() { return new LettuceConnectionFactory(redisHost, redisPort); } } ``` 4. Customize the Redis connection properties in your `application.properties` or `application.yml` file. Here's an example: ```properties spring.redis.host=localhost spring.redis.port=6379 ``` 5. With these steps in place, you should now have a RedisConnectionFactory bean available in your application's context, which you can inject into other components as needed. Please note that you may need to adjust the Redis host and port values according to your specific Redis server configuration.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值