小编for*_*rtm的帖子

Spring AOP使用Java 8提供IllegalArgumentException

使用Java 8和Spring AOP 4.0.6我收到以下错误

    java.lang.RuntimeException: Error scanning file MonitorAroundPerformance.class
    at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:705)
    at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:686)
    at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:686)
    at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:686)
    at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:686)
    at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:686)
    at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:821)
    at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:159)
    at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:531)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536)
    at java.lang.Thread.run(Thread.java:745)
Caused by: 
java.lang.IllegalArgumentException
    at org.objectweb.asm.ClassReader.<init>(Unknown Source)
    at org.objectweb.asm.ClassReader.<init>(Unknown Source)
    at org.objectweb.asm.ClassReader.<init>(Unknown Source)
    at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:970)
    at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:700)
    at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:686)
    at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:686)
    at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:686)
    at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:686)
    at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:686)
    at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:821)
    at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:159)
    at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:531)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536)
    at java.lang.Thread.run(Thread.java:745)
Run Code Online (Sandbox Code Playgroud)

但是,当我将Java Source和target更改为1.7时,此错误就会消失.POM.xml设置 -

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-framework-bom</artifactId>
            <version>4.0.6.RELEASE</version> …
Run Code Online (Sandbox Code Playgroud)

java spring jetty spring-aop

3
推荐指数
1
解决办法
2374
查看次数

yii2 activeform与同步ajax错误

下面的视图由ajax呈现,并从控制器返回到JS,JS将视图放入正确的容器中:

$page =  $this->renderAjax("view", [
                                "dataProvider" => $dataProvider
                     ]) ;
        Yii::$app->response->format = 'json';
        return array("error"=>false,"page"=>$page);
Run Code Online (Sandbox Code Playgroud)

查看:

<?= 
    ListView::widget([
        'id'=>'dataListId',
        'dataProvider' => $dataProvider,
        'itemOptions' => ['class' => 'item'],
        'itemView' => '_dataItemView',
        'summary'=>'',
        'emptyText'=>$emptyPage         
    ]) 
?>


<?=
         $this->render("_activeFormPage")
?>  
Run Code Online (Sandbox Code Playgroud)

messages?id = 1:950不赞成在主线程上使用同步XMLHttpRequest,因为它会对最终用户的体验产生不利影响。如需更多帮助,请访问https://xhr.spec.whatwg.org/

但这在完全刷新时为同步XMLhttprequest在chrome中出现上述错误,其中我通过触发单击ajax并获取上述数据的按钮来模拟ajax。一旦渲染_activeFormPage的行被注释,错误就会消失。

我们如何摆脱同步ajax错误,因为在javascript中,从jquery进行ajax调用时,async已被保留为默认值

jquery yii2

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

SQL查询模式和相对性能

考虑具有主键的表作为columnd"id"

必须查询一系列id为[1,2,3,4 ......]

有2个选项 -

1)

Select * from Table where id = 1;
Select * from Table where id = 2;
Select * from Table where id = 3;
Select * from Table where id = 4;
Run Code Online (Sandbox Code Playgroud)

2)

Select * from Table where id in ( 1, 2, 3, 4 );
Run Code Online (Sandbox Code Playgroud)

对于Oracle而言,这两者中的哪一个在性能方面更好,并且使用Spring JDBC模板来实现持久性.假设数据集1,2,3,4将在java数据结构的限制范围内,请从应用程序的角度考虑内存约束.

它使用数据库连接池.

java sql oracle spring-jdbc spring-batch

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

确保与关系数据库的一致性,无需外键

我见过像discourse这样的例子,其中关系数据库中的表没有外键。虽然 RDB 的其他租户仍在使用,如 CONSTRAINTS、INDEXES、FULLTEXTSEARCH 等,但根据 Rails Active record 指南,外键已被删除。

https://meta.discourse.org/t/foreign-key-constraints-in-db/2642

我们是否需要定期检查此类应用程序的一致性?在这种情况下,应该对每个请求-响应进行不存在无效外键的操作,并同时在应用层进行更正。

postgresql ruby-on-rails

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

ember-data保存并找到postgrest

如果我们必须将ember-data及其save()和find()方法与postgrest样式的REST调用集成,那么ember-data本身就能理解json-api,我们需要在哪里进行更改?

我们是否需要在ember或某些服务器端逻辑中修改客户端,以便与ember-data要求进行映射.

因此,最后的REST api调用看起来像是从相关表格中获取电影及其标题和competition.name - >

http://localhost:3001/film?select=title,competition{name}
http://localhost:3001/users?select=email::text&id=eq.2&sign_in_count=eq.16
Run Code Online (Sandbox Code Playgroud)

ember.js ember-data postgrest

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

通过分段文件上传处理动态密钥

使用下面的 API 和 input ,会消耗多部分/表单请求,但对于所有文件,键是静态“文件”,因为RequestPart("files") 但是所有字符串的键都是动态的,因为Map<String,String>

@PostMapping(value = "/xyz", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> uploads(@RequestPart("files") MultipartFile[] outputFiles, @RequestParam Map<String, String> keyValues {
...
}

files - file_1_name
files - file_2_name
files - file_3_name
key1  - value1
key2  - value2
Run Code Online (Sandbox Code Playgroud)

然而下面的 API 并没有按预期工作。需要为上传的每个文件提供动态密钥,并且要上传的文件总数未知,因此使用 >Map<String, MultipartFile而不是MultipartFile[]。它仍然期望每个上传的文件都有静态密钥“outputFiles”。

@PostMapping(value = "/xyz", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> uploads(@RequestPart Map<String, MultipartFile> outputFiles, @RequestParam Map<String, String> keyValues {
...
}

Input
======
file_1_name …
Run Code Online (Sandbox Code Playgroud)

java spring spring-mvc spring-boot

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