小编saj*_*jib的帖子

ApplicationContextException:由于缺少ServletWebServerFactory bean,无法启动ServletWebServerApplicationContext

我使用Spring启动编写了一个Spring批处理应用程序.当我尝试在本地系统上使用命令行和类路径运行该应用程序时,它运行正常.但是,当我试图在Linux服务器上运行它时,它给了我以下异常

Unable to start web server; nested exception is
org.springframework.context.ApplicationContextException: 
Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
Run Code Online (Sandbox Code Playgroud)

以下是我运行它的方式:

java -cp jarFileName.jar; lib\* -Dlogging.level.org.springframework=DEBUG -Dspring.profiles.active=dev -Dspring.batch.job.names=abcBatchJob com.aa.bb.StartSpringBatch > somelogs.log
Run Code Online (Sandbox Code Playgroud)

spring spring-batch spring-boot

25
推荐指数
9
解决办法
6万
查看次数

docker 容器上传文件

我有一个弹簧启动应用程序。Docker 容器无权创建文件。

泊坞窗文件:

FROM openjdk:8-jdk-alpine

VOLUME /tmp

ADD /build/libs/file-upload-service-2.0.0.jar app.jar

ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
Run Code Online (Sandbox Code Playgroud)

图像构建命令:

docker build -t file-upload-service .
Run Code Online (Sandbox Code Playgroud)

图像运行命令:

docker run -d --name file-upload-service -p 9104:9104 file-upload-service:latest
Run Code Online (Sandbox Code Playgroud)

文件夹权限:

sudo chown -R  root:docker  /home/storage/

sudo chmod -R 777 /home/storage/
Run Code Online (Sandbox Code Playgroud)

运行时java -jar,应用程序可以创建文件。

docker spring-boot dockerfile

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

使用java8流组合的规范列表

如何使用Java8流代码:

Specification<T> specification = specifications.getSpec(searchCriteria.getConditions().get(0));
        for(int i = 1; i < searchCriteria.getConditions().size(); i++) {
            specification = specification.and(getSpec(searchCriteria.getConditions().get(i)));
    }
Run Code Online (Sandbox Code Playgroud)

使用Stream:

  IntStream.range(1,searchCriteria.getConditions().size())
                    .mapToObj(index-> getSpec(searchCriteria.getConditions().get(index)))
                    .collect();//how to merge with calling and
Run Code Online (Sandbox Code Playgroud)

相关类&&方法:

@Getter
@Setter
public class SearchCriteria implements Serializable{

    private static final long serialVersionUID = 1L;

    private List<Condition> conditions;
    private Integer limit;
    private Integer offset;

    @Getter
    @Setter
    public class Condition{
        private String key;
        private EConstant.OPERATION operation;
        private String value;
    }
}
public Specification<T> getSpec(SearchCriteria.Condition condition){
....
}
Run Code Online (Sandbox Code Playgroud)

java java-8 spring-data-jpa spring-boot

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

在 Laravel 中从 6000k+ 记录数据库中搜索单个记录的有效方法

我想知道如何从6000k+记录数据库中搜索单个记录。我已经为其编写了一个查询,但我面临的15s加载时间对于高效系统来说太长了,因此请帮助我以有效的方式进行搜索,以缩短搜索的响应时间。

$users = DB::select('select * from tablefour where Provider_Business_Mailing_Address_Fax_Number = ?', array($request['id'])); 
return $users;
Run Code Online (Sandbox Code Playgroud)

mysql sql laravel

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

如何从三个排序的 A、B、C 中找到三元组 { x , y , z } 使得 x &lt; y &lt; z 在 O(n) 中?

假设我有三个排序的数组

答:{ 4, 9 }

乙:{2, 11}

C : { 12, 14}

那么三元组 { x, y, z } 的数量,使得 x 属于 A,y 属于 B,z 属于 C,使得 x < y < z 是 -> 4

我知道 O( n ^3 ) 算法,但如何在 O(n) 中做到。其中 n 是数组的长度。

sorting algorithm c++11

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