草庐IT

spring-cloud-starter-lo

全部标签

java - Spring Rest Web 服务将文件作为资源返回

我正在尝试从部署在服务器上的RestWeb服务返回一个文件流,并从客户端上的RestWeb服务处理这个流。在服务器上我使用这段代码:@Override@RequestMapping(value="/file",method=RequestMethod.GET,produces=MediaType.APPLICATION_OCTET_STREAM_VALUE)public@ResponseBodyResourcegetAcquisition(@RequestParam(value="filePath",required=true)StringfilePath)throwsFileNotF

java - 如何使用Spring Batch实现步骤的分布式处理

使用Spring批处理,我希望我的步骤跨节点分布,并让它们针对给定的作业执行。我有一个用例,其中一个作业有多个步骤,每个步骤都可以在托管应用程序的多个节点中运行。有人试过这个吗?任何关于相同的想法将不胜感激! 最佳答案 有两种方法:Remotechunking-您在主节点上读取数据并在从节点上处理/写入数据Remotepartitioning-您将数据集分成多个分区,并在远程节点中读取/处理/写入您的分区。所以master只是协调和决定如何划分分区。我写了一本关于EnterpriseSpring的书,并创建了这两种方法的示例。这些是

java - 使用 Elastic Cloud/Found 随机断开与主节点 NoNodeAvailableException 的连接

我正在使用带防护罩和传输Java客户端的弹性云(以前发现的)。与ES通信的应用程序运行在heroku上。我正在使用一个节点在暂存环境中运行压力测试{"cluster_name":...,"status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":19,"active_shards":19,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":7,"delayed

java - Spring Security @WithMockUser 不适用于 cucumber 测试

我正在使用Cucumber测试来测试启用了SpringSecurity的SpringBoot应用程序。一切正常,除非我使用Cucumber测试运行我的测试套件,一些使用SpringSecurity的测试,例如。@WithMockUser(username="BROWSER",roles={"BROWSER","ADMIN"})失败。如果我将它们作为简单的junit测试单独运行,这些测试确实有效,但在使用Cucumber测试步骤运行时失败。当我对Cucumber测试运行相同的行为时,问题看起来像是spring安全测试模拟行为没有得到应用。我的cucumber测试运行类如下@RunWith

java - 如何在 spring 表单中绑定(bind)子类对象作为 modelAttribute 提交

我有ClassShape{//Implementation}ClassRoundextendsShape{//Implementation}Controller我有@Requestmapping(value="/view/form")publicModelAndViewgetForm(){ModelAndViewmav=newModelAndView();mav.addObject("shape",newRound());}@RequestMapping(value="/submit",method=RequestMethod.POST)publicModelAndViewsubmit

java - Spring Cache - 创建自定义 CacheManager

我正在使用SpringBoot和EhCache开发日历应用程序。我正在尝试缓存以下方法:@Override@Cacheable(value="concerts")publicListgetEvents(StringeventsForUser,DatestartDate,DateendDate)throwsException{returnfetchEventsFromTheServer(eventsForUser,startDate,endDate);}挑战是我想操纵返回的缓存结果。例如,检查是否有给定日期但不同用户的缓存,然后返回它(只要两个用户都满足特定条件)。所以,在返回结果之前我

java - spring boot - 如何正确定义模板位置?

在使用Spring应用程序(和springboot,就此而言)苦苦挣扎了一段时间之后,看来我终于要让它工作了。我已经完成了依赖解析和Maven构建。应用程序启动(而且非常快!)但是当我尝试访问localhost:8080每当我尝试访问应用程序的登录页面时,我都会收到以下浏览器消息:HTTPStatus500-Requestprocessingfailed;nestedexceptionisorg.thymeleaf.exceptions.TemplateInputException:Errorresolvingtemplate"home/homeNotSignedIn",templat

java - Intellij spring boot 扩展 gradle 构建文件中的 processResources 以替换属性

当使用gradlebuild命令从命令行构建时,属性字段被正确替换,但是,当使用IntelliJIDEAIDE时,它不是。代码在build.gradleext{port=8086}processResources{filesMatching('application.properties'){expand(project.properties)}}代码在application.propertiesserver.port=${port} 最佳答案 当您通过单击“运行”按钮在IntelliJ中运行SpringBoot应用程序时,它会以常

java - 带有 Eureka 服务器的 Spring Boot 1.4.2.RELEASE - 异常 : org. springframework.beans.factory.NoSuchBeanDefinitionException

尝试使用Eureka服务器运行SpringBoot1.4.2.RELEASE时出现以下错误:2016-11-2016:25:59.306INFO14263---[main]s.c.a.AnnotationConfigApplicationContext:Refreshingorg.springframework.context.annotation.AnnotationConfigApplicationContext@2177849e:startupdate[SunNov2016:25:59CET2016];rootofcontexthierarchy2016-11-2016:25:5

java - 如何将 JAXB 注释与 Spring RestTemplate 一起使用?

我正在尝试使用Spring的RestTemplate自动反序列化XML格式的响应。我正在使用Jackson的jackson-dataformat-xml模块,为此SpringBoot设置为自动配置。我想在要反序列化到的类中使用JAXB注释,但它似乎不起作用。这是我希望类看起来像的示例:@XmlRootElement(name="Book")publicclassBook{@XmlElement(name="Title")privateStringtitle;@XmlElement(name="Author")privateStringauthor;}这基于以下XML示例:MyBookM