springboot获取mysql的text类型数据返回值null

发生背景

在我们前台展示页面中,我们想要展示一部分图片,我们在数据库中用的是text类型存储,但是在展示的时候返回值为null

解决方案

mybaits 对应的resultMap  jdbcType="LONGVARCHAR"

 <result column="img_last " jdbcType="LONGVARCHAR" property="imgLast"/>

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Spring Boot中整合Elasticsearch 6.0版本的步骤如下: 1. 首先,在pom.xml文件中添加Elasticsearch依赖: ```xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-elasticsearch</artifactId> </dependency> ``` 2. 在application.properties文件中配置Elasticsearch的连接信息: ```properties # Elasticsearch connection settings spring.data.elasticsearch.cluster-name=my-cluster spring.data.elasticsearch.cluster-nodes=localhost:9300 ``` 3. 创建一个实体类,用于映射Elasticsearch中的索引和类型。例如,创建一个名为`Product`的实体类: ```java @Document(indexName = "products", type = "product") public class Product { @Id private Long id; @Field(type = FieldType.Text) private String name; // Getters and setters } ``` 4. 创建一个继承自`ElasticsearchRepository`接口的数据访问接口,用于操作Elasticsearch中的索引。例如,创建一个名为`ProductRepository`的接口: ```java public interface ProductRepository extends ElasticsearchRepository<Product, Long> { // Additional custom methods can be defined here } ``` 5. 在需要使用Elasticsearch的地方注入`ProductRepository`,并使用其提供的方法进行索引的增删改查。 ```java @Service public class ProductService { @Autowired private ProductRepository productRepository; public void saveProduct(Product product) { productRepository.save(product); } public Iterable<Product> searchProducts(String keyword) { return productRepository.findByName(keyword); } // Other methods for CRUD operations } ``` 以上就是使用Spring Boot整合Elasticsearch 6.0的基本步骤。通过以上配置和代码,可以实现与Elasticsearch的连接和数据交互操作。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值