草庐IT

apache-wink-spring

全部标签

java - Apache Kafka 根据消息的值对窗口消息进行排序

我正在尝试找到一种方法来重新排序主题分区内的消息并将排序后的消息发送到新主题。我有Kafka发布者发送以下格式的字符串消息:{system_timestamp}-{event_name}?{parameters}例如:1494002667893-client.message?chatName=1c&messageBody=hello1494002656558-chat.started?chatName=1c&chatPatricipants=3此外,我们为每条消息添加一些消息key,以将它们发送到相应的分区。我想做的是根据消息的{system-timestamp}部分并在1分钟的窗口内

java - Spring 安全过滤器验证成功但发回 403 响应

我有一个具有以下网络安全配置的springboot应用程序:@Overrideprotectedvoidconfigure(HttpSecurityhttp)throwsException{http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and().authorizeRequests().antMatchers("/login**","/signup**").permitAll().and().csrf().disable().authorizeRequests().anyR

java - Spring @ExceptionHandler 和多线程

我有以下Controller建议:@ControllerAdvicepublicclassExceptionHandlerAdvice{@ExceptionHandler(NotCachedException.class)@ResponseStatus(HttpStatus.BAD_REQUEST)publicModelAndViewhandleNotCachedException(NotCachedExceptionex){LOGGER.warn("NotCachedException:",ex);returngenerateModelViewError(ex.getMessage(

java - spring boot kafka LocalDateTime

我有一个包含java.time.LocalDateTime的基本POJO:packagefoo.bar.asire.api.model;importjava.time.LocalDateTime;publicclassAddress{privateLongid;privateIntegerhouseNumber;privateStringaddress;privateLocalDateTimecreated;publicAddress(){super();}publicAddress(Longid,IntegerhouseNumber,Stringaddress,LocalDateTi

java - 如何将 JVM 选项添加到由 mvn spring-boot :run 启动的程序

将JVM选项添加到由mvnspring-boot:run启动的程序的最佳方法是什么? 最佳答案 您可以配置spring-boot-maven-plugin在运行时始终包含您的jvm选项:org.springframework.bootspring-boot-maven-plugin-Dapp.name=test或者如果您不需要这些参数永久保留,请在命令行上使用它:mvnspring-boot:run-Drun.jvmArguments="..."检查documentation了解详情。

java - 在 Bluemix 上使用 Liberty for Java 的 Cloud Foundry/Spring Boot 应用程序在启动时突然崩溃,几个月来没有更改代码

我有一个在Bluemix上使用Springboot提供的javascript/html/css应用程序。在本地运行该应用程序工作正常,并且代码在几个月内没有更改。当我尝试使用CFCLI推送应用程序时,出现以下错误:2017-11-13T12:18:29.89-0600[CELL/0]OUTSuccessfullydestroyedcontainer2017-11-13T12:19:33.32-0600[CELL/0]OUTCreatingcontainer2017-11-13T12:19:37.70-0600[CELL/0]OUTSuccessfullycreatedcontainer

java - 当作业重叠时,spring @scheduled cron 的预期行为是什么?

我有一个每小时运行一次的作业,我正在使用Spring的@scheduledcron来安排它。如果工作需要一个多小时,我从HowtopreventoverlappingschedulesinSpring?了解到在第一个作业运行时,下一个作业不会启动。但这是否意味着它会在第一份工作完成后开始,还是错过了机会?如果我有一个需要10小时的作业,所有错过的cron作业是否会排队,然后在第一个作业在10小时后完成时一个接一个地执行,还是只运行第一个作业?谢谢! 最佳答案 默认情况下,执行是阻塞的和单线程的,这意味着它们不会并发运行。如果您希望作

java - 覆盖单个 Spring Boot 测试的属性

考虑以下示例:@RunWith(SpringRunner.class)@SpringBootTest(webEnvironment=SpringBootTest.WebEnvironment.RANDOM_PORT,properties={"some.property=valueA"})publicclassServiceTest{@TestpublicvoidtestA(){...}@TestpublicvoidtestB(){...}@TestpublicvoidtestC(){...}}我正在使用SpringBootTest注释的properties要设置的属性some.prop

spring - 如何在 JAVA 的 rest API 中将图像返回给浏览器?

我想要一个图像,同时我点击一个API,比如localhost:8080:/getImage/app/path={imagePath}当我点击这个API时,它会返回一张图片。这可能吗?实际上,我已经试过了,但它给了我一个错误。这是我的代码,@GET@Path("/app")publicBufferedImagegetFullImage(@ContextUriInfoinfo)throwsMalformedURLException,IOException{StringobjectKey=info.getQueryParameters().getFirst("path");returnres

java - Swagger with Spring Boot 2.0 导致 404 错误页面

我正在尝试将我的SpringBoot版本2.0.1.RELEASE与Swagger集成.从这里blogpost似乎只需添加两个Maven依赖项就很容易,一切都应该可以正常工作。所以我在pom中添加了以下依赖:io.springfoxspringfox-swagger22.8.0io.springfoxspringfox-swagger-ui2.8.0并创建了SwaggerConfigbean:@Configuration@EnableSwagger2publicclassSwaggerConfig{@BeanpublicDocketapi(){Docketdocket=newDocke