首页 » 2019年5月

最近发现blazy的一个小bug,原因竟然是一个属性导致的。

1.首先引入 js

<script src="//cdn.jsdelivr.net/blazy/latest/blazy.min.js"></script>
<script>
    window.bLazy = new Blazy({
        container: '.content',
        success: function (element) {
            console.log("Element loaded: ", element.nodeName);
        }
    });
</script>

2.然后加入要加载的图片,看起来没毛病吧,老铁,但是死活加载不出来。

<img class="b-lazy animate b-loaded" data-src="http://cdn.dinbror.dk/assets/blazy/02.jpg" >

3.然后我加入alt 属性,然后图片就出来了,来了,了。。。。

<img class="b-lazy animate b-loaded" data-src="http://cdn.dinbror.dk/assets/blazy/02.jpg"  alt="Lazy load images example 1b" >

4.这什么bug啊,必须有alt属性?反正分享出来给大家一个防坑指南

org.springframework.data.repository.query.ParameterOutOfBoundsException: Invalid parameter index! You seem to have declared too little query method parameters!

原因是没有少了个By,30后面必须有by

Flux<MySeries> findTop30ByOrderByRatingDesc();

open feign默认不打印日志,这对debug很不方便,配置方法如下

[1]配置config

@Configuration
public class UserClientConfig {

    @Bean
    Logger.Level feignLoggerLevel() {
        return Logger.Level.HEADERS;
    }
} 

[2]配置feignclient

@FeignClient(name = "User", url = "http://localhost:8080",configuration=UserClientConfig.class)
public interface UserClient {

    @RequestMapping(method = RequestMethod.GET, value = "/user")
    List<User> getAllUsers();    

}

[2]配置application.properties

logging.level..UserClient:DEBUG

Caused by: org.h2.jdbc.JdbcSQLDataException: Value too long for column """BRIEF"" VARCHAR(255) ,h2 生成的默认长度是255
[1]报错如下:
Caused by: org.h2.jdbc.JdbcSQLDataException: Value too long for column """BRIEF"" VARCHAR(255)": "STRINGDECODE('\uff1aDuenpatra\uff08pim\uff09\u5728\u5979\u7684\u7956\u6bcd\u4f4f\u5b85\u7684Prapim\u5f00\u4e86\u4e00\u5bb6\u81ea... (320)"; SQL statement:
insert into my_season (actors, brief, cat, cover, finish, pinyin, plays, rating, score, season_no, title, title_en, year, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [22001-199]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:455) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:427) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.message.DbException.get(DbException.java:205) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.table.Column.validateConvertUpdateSequence(Column.java:441) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.table.Table.validateConvertUpdateSequence(Table.java:824) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.command.dml.Insert.insertRows(Insert.java:175) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.command.dml.Insert.update(Insert.java:132) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.command.CommandContainer.update(CommandContainer.java:133) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.command.Command.executeUpdate(Command.java:267) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:200) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:154) ~[h2-1.4.199.jar:1.4.199]
    at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61) ~[HikariCP-3.2.0.jar:na]
    at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java) ~[HikariCP-3.2.0.jar:na]
    at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:175) ~[hibernate-core-5.3.9.Final.jar:5.3.9.Final]
    ... 89 common frames omitted

[2]解决办法,加上下面的声明,注意如果是内存中,需要重启,如果文件中,需要删除重新运行

@Column(length = 2000)
private String brief;

[3]或者


@Column(columnDefinition = "TEXT")
private String brief;