小编Joe*_*mes的帖子

Spring Web Reactive Framework多部分文件问题

我试图通过尝试以下方法使用Spring的Reactive Framework实现和映像上传:

@RestController
@RequestMapping("/images")
public class ImageController {

    @Autowired
    private IImageService imageService;

    @PostMapping(value = "", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    Mono<ImageEntity> saveImage(@RequestBody Mono<FilePart> part) throws Exception{
         return part.flatMap(file -> imageService.saveImage(file));
    }
}
Run Code Online (Sandbox Code Playgroud)

但我一直收到415,出现以下错误信息:

Response status 415 with reason "Content type 'multipart/form-data;boundary=--0b227e57d1a5ca41' not supported\
Run Code Online (Sandbox Code Playgroud)

不确定是什么问题,我正在通过以下方式卷曲API:

 curl -v -F "file=@jinyang.gif" -H "Content-Type: multipart/form-data" localhost:8080/images
Run Code Online (Sandbox Code Playgroud)

我尝试过不同的标题和文件变体,结果相同.这里有点不知所措,因为我过去做过这件事情似乎工作正常.我在这篇文章中看到这个功能被合并了:

如何启用Spring Reactive Web MVC来处理Multipart文件?

spring spring-mvc project-reactor reactive

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

获取用于后端测试的 Firebase 令牌

我正在编写一个应用程序,我想在其中使用 Firebase 对任何类型的后端调用进行身份验证。有没有办法让我通过 CLI 或curl本地测试获取令牌,而无需启动前端来获取令牌?

firebase firebase-authentication

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

PowerMock AmazonS3Client配置问题

尝试使用PowerMock运行Mock测试时出现此堆栈

 Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.amazonaws.services.s3.AmazonS3Client]: Factory method   'amazonS3Client' threw exception; nested exception is org.apache.http.conn.ssl.SSLInitializationException: class configured for SSLContext: sun.security.ssl.SSLContextImpl$TLSContext not a SSLContext
 Caused by: org.apache.http.conn.ssl.SSLInitializationException: class  configured for SSLContext: sun.security.ssl.SSLContextImpl$TLSContext not a SSLContext
 Caused by: java.security.NoSuchAlgorithmException: class configured for SSLContext: sun.security.ssl.SSLContextImpl$TLSContext not a SSLContext
Run Code Online (Sandbox Code Playgroud)

我已经尝试过使用@添加@PowerMockIgnore的建议,org.apache.http.con.ssl.*但是这样做会导致Rabbit连接器失败。我不确定是否有任何建议可以同时满足我的测试要求。如果测试不需要它,是否不初始化它?

我的能力有限,因为这对我的公司来说很重要。

使用Amazon SDK:1.11.69

这是我配置测试的方式

@RunWith(PowerMockRunner.class)
@PowerMockRunnerDelegate(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(locations={"classpath:applicationContext-test.xml"})
@TestExecutionListeners(listeners={ServletTestExecutionListener.class,
        DependencyInjectionTestExecutionListener.class,
        DirtiesContextTestExecutionListener.class,
        TransactionalTestExecutionListener.class,
        WithSecurityContextTestExecutionListener.class})
@PrepareForTest({Observable.class,HardDeleteUserCommand.class,SoftDeleteUserCommand.class})
@PowerMockIgnore({ "javax.management.*", "ch.qos.logback.*",
    "org.slf4j.*" })
Run Code Online (Sandbox Code Playgroud)

示例Bean:

@Configuration
@Profile("Test")
public class S3Configuration {
    @Bean
    public AmazonS3Client amazonS3Client() …
Run Code Online (Sandbox Code Playgroud)

java spring amazon-s3 powermockito

5
推荐指数
2
解决办法
5668
查看次数

弹簧启动执行器/千分尺度量禁用一些

有没有办法在执行器/千分尺中关闭一些返回的公制值?现在看着它们我已经看到了1000左右,并希望将它们减少到少数几个说100实际被发送到我们的注册表.

metrics spring-boot-actuator micrometer

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

TensorFlow 服务于 S3 和 Docker

我正在尝试找到一种方法来使用 Tensorflow 服务并能够添加新模型和新版本的模型。我可以将 tensorflow 服务指向 S3 存储桶吗?

我还需要它作为容器运行吗?这是可能的还是我需要实现另一个程序来下拉模型并将其添加到共享卷并要求 tensorflow 更新文件系统中的模型?

或者我是否需要构建自己的 docker 镜像才能从 s3 中提取内容?

tensorflow tensorflow-serving

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