小编Kre*_*oni的帖子

如何解决jackson中属性的冲突getter定义

我有一些模特课.

public interface Product extends Serializable {
    public Sku getDefaultSku();

   public void setDefaultSku(Sku defaultSku);
}

public interface Sku extends Serializable {
     public Boolean isTaxable();

    public Boolean getTaxable();

    public void setTaxable(Boolean taxable);
}

public interface PremiumProduct extends Product {
   public Long getProductCode();

   public void setProductCode(Long productCode);
}
Run Code Online (Sandbox Code Playgroud)

无法修改Product和Sku实现.我只从产品延伸.之后,我从spring MVC控制器传输JSON对象.我的控制器方法是

@RequestMapping(value="/productDetail", method=RequestMethod.GET)
    public @ResponseBody Product getCustomerName(@RequestParam String productUrl) throws Exception {

      Product product = catalogService.findProductByURI(productUrl);      

                return product;
    }
Run Code Online (Sandbox Code Playgroud)

我有以下例外情况.

<h2>HTTP ERROR 500</h2>
<p>Problem accessing /productDetail. Reason:
<pre>    Conflicting getter definitions for property …
Run Code Online (Sandbox Code Playgroud)

spring json jackson

14
推荐指数
3
解决办法
3万
查看次数

如何在solr搜索中防止特殊字符

目前我已在我的项目中开发了solr搜索.搜索是工作.但是,当我放置一些像([] white space)这样的特殊字符时,我得到了例外.

Caused by: org.apache.lucene.queryParser.ParseException: Cannot parse 'searchable:       ([])': Encountered " "]" "] "" at line 1, column 13.
 Was expecting one of:
 <RANGEIN_QUOTED> ...
 <RANGEIN_GOOP> ...

at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:211)
at org.apache.solr.search.LuceneQParser.parse(LuceneQParserPlugin.java:79)
at org.apache.solr.search.QParser.getQuery(QParser.java:143)
at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:105)
... 104 more
Run Code Online (Sandbox Code Playgroud)

那么,我该如何处理这种情况呢.如何防止搜索框中的特殊字符.

solr

2
推荐指数
1
解决办法
5056
查看次数

标签 统计

jackson ×1

json ×1

solr ×1

spring ×1