小编Pau*_*NUK的帖子

set -e和exec"$ @"为docker入口点脚本做了什么?

我注意到docker的许多entrypoint.sh脚本都是这样的:

#!/bin/bash
set -e

... code ...

exec "$@"
Run Code Online (Sandbox Code Playgroud)

什么是set -eexec "$@"为什么?

shell docker

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

在IE11中下载文件获取错误"'Uint8Array'未定义"

我正在创建一个我正在下载文件的应用程序.为此,我从js中的java类得到响应并下载此响应.为此我的java代码是 -

@ApiOperation(value = "",
            notes = "")
@Path("/getProjectJSONTODRAW/{implementation}")
@GET
@Timed
public Response getProjectJSONTODRAW(@PathParam("implementation") String implementation) {
        File file = new File(path+File.separator+fileName);
        InputStream inputStream =null;
        String mimeType =null;
        if (!file.exists()) {
            String errorMessage = "Sorry. The file you are looking for does not exist";
            log.info(errorMessage);
        }else {
            mimeType = URLConnection.guessContentTypeFromName(file.getName());
            if (mimeType == null) {
                log.info("mimetype is not detectable, will take default for the file "+file.getName());
                mimeType = "application/octet-stream";
            }
            try {
                inputStream = new BufferedInputStream(new FileInputStream(file));
            } catch (FileNotFoundException …
Run Code Online (Sandbox Code Playgroud)

javascript blob download internet-explorer-11

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

当没有persistence.xml时,如何使用EclipseLink静态编织JPA实体,因为这些实体由Spring管理

我有一个基于Spring的项目,因此以编程方式设置了实体管理器,不需要persistence.xml文件列出所有实体。

我目前正在使用加载时间编织,但是正在尝试使用Eclipselink和Gradle进行静态编织。我想复制由Maven eclipselink插件执行的操作:

https://github.com/ethlo/eclipselink-maven-plugin

我设置了以下gradle(请注意,这不是Kotlin DSL的常规做法):

task<JavaExec>("performJPAWeaving") {


    val compileJava: JavaCompile = tasks.getByName("compileJava") as JavaCompile
    dependsOn(compileJava)

    val destinationDir = compileJava.destinationDir

    println("Statically weaving classes in $destinationDir")
    inputs.dir(destinationDir)
    outputs.dir(destinationDir)
    main = "org.eclipse.persistence.tools.weaving.jpa.StaticWeave"
    args = listOf("-persistenceinfo", "src/main/resources", destinationDir.getAbsolutePath(), destinationDir.getAbsolutePath())

    classpath = configurations.getByName("compile")


}
Run Code Online (Sandbox Code Playgroud)

当我尝试运行任务时,编织任务失败,因为它正在寻找不存在的persistence.xml。

有什么方法可以在基于Spring的JPA项目中静态编织JPA实体?

Exception Description: An exception was thrown while processing persistence.xml from URL: file:/home/blabla/trunk/my-module/src/main/resources/
Internal Exception: java.net.MalformedURLException
        at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionProcessingPersistenceXML(PersistenceUnitLoadingException.java:117)
        at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceXML(PersistenceUnitProcessor.java:579)
        at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceArchive(PersistenceUnitProcessor.java:536)
        ... 6 more
Caused by: java.net.MalformedURLException
        at java.net.URL.<init>(URL.java:627)
        at java.net.URL.<init>(URL.java:490)
        at java.net.URL.<init>(URL.java:439)
        at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:620)
        at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:148)
        at …
Run Code Online (Sandbox Code Playgroud)

spring eclipselink compile-time-weaving spring-data-jpa

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

Spring 配置类中是否可以注入构造函数?

如果我有一个 Spring 配置类(即用 @Configuration 注释的类),我可以使用构造函数注入吗?

如果我添加一个,我会得到一个没有默认构造函数的消息,如果我添加一个默认构造函数,它会使用它而不是重载的构造函数,这并没有真正的帮助。

configuration spring constructor constructor-injection

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

如何在 Spring Boot 测试中指定 text/plain;charset=UTF-8 的媒体类型

这是我的测试:

 @Test
 fun `test config properties`() {
    mockMvc.request(HttpMethod.GET,"someUrl") {
        accept = MediaType.TEXT_PLAIN
    }.andExpect {
        status { isOk }
        content { contentType(MediaType.TEXT_PLAIN) }
    }
}
Run Code Online (Sandbox Code Playgroud)

它失败了:

预期:text/plain 实际:text/plain;charset=UTF-8

这是使用适用于 MockMVC 的 Kotlin DSL。

如何更改接受以允许 charset=UTF-8 ?

spring spring-mvc kotlin spring-boot mockmvc

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

Android 上的 OpenGL - 将位图转换为纹理,并保存纹理

我和我的团队目前正在开发一个 Android 应用程序来进行快速实时和非实时图像处理。

我们面临两个问题:

首先,我们想将 Bitmap 转换为 Texture 以使用 OpenGL 着色器处理图片,然后将其转换回 Bitmap。我们尝试了一些不成功的实现,例如在 SurfaceTexture 和 Renderer 中使用 GLUtils.texImage2D 函数。

我们的第二个问题是我们目前不知道如何在我们的实时相机活动中保存纹理。我们使用 OnFrameAvailableListener 来处理图像。但就目前而言,我们无法保留原始纹理。

我们希望有人可以为我们的问题提供答案。提前致谢 !

java android opengl-es bitmap

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

在 Spring Boot 中构建分层 jar 时,如何在一个层中包含多模块项目 jar?

根据Spring Boot gradle 插件参考,我应该能够将特定模式的 jars 打包到特定层(用于制作更好的 docker 文件)。

我对文档中使用的模式匹配感到困惑。下面是一个例子:

tasks.getByName<BootJar>("bootJar") {
    layered {
        isIncludeLayerTools = true
        application {
            intoLayer("spring-boot-loader") {
                include("org/springframework/boot/loader/**")
            }
            intoLayer("application")
        }
        dependencies {

            intoLayer("module-dependencies") {
                include("com*:*:*")
            }

            intoLayer("dependencies")
        }
        layerOrder = listOf("dependencies", "spring-boot-loader", "module-dependencies", "application")
    }
}
Run Code Online (Sandbox Code Playgroud)

我不明白的是这种模式匹配匹配的是什么:

intoLayer("module-dependencies") { include("com*: : ") }

它是 jar 的组、工件和版本吗?这是罐子的名字吗?

如果我有一个多模块项目,其中包含模块 aa、ab 和 ac,相当于 aa.jar、ab.jar 和 ac.jar 以及一个外部依赖项 org.something:anartifact:25 相当于 anartifact-25.jar 什么模式我是否需要添加以在一层中包含 aa、ab 和 ac,在另一层中包含所有其他依赖项?

spring-boot spring-boot-gradle-plugin

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

Spring + Apache CXF @Autowire在服务中始终为null

我使用Apache CXF创建了soap服务,我创建了一个@WebService.在该服务中,我需要注入@Service.当我@Autowire服务该实例仍然为null.

端点初始化

@Bean
    public Endpoint endpointToken() {
        EndpointImpl endpoint = new EndpointImpl(bus, new GenerateLoginToken());



        endpoint.publish("/Token");

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

Serivce Class

@WebService(serviceName = "GenerateToken", portName = "TokenPort",
    targetNamespace = "http://service.ws.samp",
    endpointInterface = "com.web.sigel.ws.soap.webServices.GenerateToken")
@Service("AuthService")
public class GenerateLoginToken implements  GenerateToken {

    @Autowired
    private  AuthService authService; //this remains Null whenever i make a call. 



    @Override
    @RequestWrapper(localName = "loginRequest", targetNamespace = "http://service.ws.samp", className = "com.web.sigel.ws.soap.security.LoginRequest")
    public LoginResponse generateToken(LoginRequest loginRequest) {
        LoginResponse loginResponse = new LoginResponse();
         String token  = authService.createAuthToken(loginRequest);

         loginResponse.setToken(token);

        return loginResponse;
    } …
Run Code Online (Sandbox Code Playgroud)

java spring soap cxf

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