我得到了一个有效的弹簧靴休息服务.当路径错误时,它不会返回任何内容.完全没有回应.同时它也不会抛出错误.理想情况下,我期望404找不到错误.
我有一个GlobalErrorHandler
@ControllerAdvice
public class GlobalErrorHandler extends ResponseEntityExceptionHandler {
}
Run Code Online (Sandbox Code Playgroud)
ResponseEntityExceptionHandler中有此方法
protected ResponseEntity<Object> handleNoHandlerFoundException(NoHandlerFoundException ex, HttpHeaders headers,
HttpStatus status, WebRequest request) {
return handleExceptionInternal(ex, null, headers, status, request);
}
Run Code Online (Sandbox Code Playgroud)
我已error.whitelabel.enabled=false在我的属性中标记
我还必须为此服务做些什么才能将404未找到的响应返回给客户端
我提到了很多线索,并没有看到任何人面临这种麻烦.
这是我的主要应用程序类
@EnableAutoConfiguration // Sprint Boot Auto Configuration
@ComponentScan(basePackages = "com.xxxx")
@EnableJpaRepositories("com.xxxxxxxx") // To segregate MongoDB
// and JPA repositories.
// Otherwise not needed.
@EnableSwagger // auto generation of API docs
@SpringBootApplication
@EnableAspectJAutoProxy
@EnableConfigurationProperties
public class Application extends SpringBootServletInitializer {
private static Class<Application> appClass = Application.class;
@Override …Run Code Online (Sandbox Code Playgroud) 如果这是重复,请原谅我.这是我的binding.xjb文件.但现在我得到的常规错误是找不到复杂类型目标"AddBankVaultRplyType".我没有看到任何问题.有人可以帮我这个吗?我列出了我想要自定义的xsd
<jxb:bindings
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:pd="http://chubb.com/cpi/polsvc/xmlobj"
xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance"
jxb:extensionBindingPrefixes="inheritance"
jxb:version="2.1"
>
<jxb:bindings node="/xs:schema/xs:ServiceReply/xs:complexType[@name='AddBankVaultRplyType']">
<inheritance:extends>com.print.poc.AddressTypeHelper</inheritance:extends>
</jxb:bindings>
Run Code Online (Sandbox Code Playgroud)
这是我试图定制的XSD
<xs:schema xmlns:pd="http://com/polsvc/xmlobj" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://com/polsvc/xmlobj" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:complexType name="AddBankVaultRplyType">
</xs:complexType>
<xs:element name="ServiceReply">
<xs:complexType>
<xs:sequence>
<xs:element name="ReplyHeader" type="pd:MsgHeaderType"/>
<xs:element name="RequestHeader" type="pd:MsgHeaderType"/>
<xs:choice>
<xs:element name="AddBankVaultReply" type="pd:AddBankVaultRplyType"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Run Code Online (Sandbox Code Playgroud)
现在,如果我运行XJC,它告诉我目标"/xs:schema/xs:ServiceReply/xs:complexType[@name='AddBankVaultRplyType']"导致空节点.我在这里做的错误是什么?
我在cygwin,Windows 7 Professional中使用cURL命令将文件上传到目的地,我看到端口号以消息结束.我的错误在哪里?请帮我
$ curl -k -u username:'password' --cacert D:/'My Data'/Desktop/cacert.pem -X POST "jsonInputParameters={\"parentID\":\"FAECDB25A7775B98062FEF15F6C3FF17C1177A968060\"}" -F "primaryFile=@C:/Users/user/AppData/Local/Temp/2704092483770369841.pdf" https://host/documents/api/1.1/files/data
curl: (3) Port number ended with '"'
Run Code Online (Sandbox Code Playgroud) 这是我的步骤配置.我的跳过侦听器onSkipInWrite()方法被正确调用.但onSkipInRead()没有被调用.我故意从读者那里抛出空指针异常,从而发现了这一点.
<step id="callService" next="writeUsersAndResources">
<tasklet allow-start-if-complete="true">
<chunk reader="Reader" writer="Writer"
commit-interval="10" skip-limit="10">
<skippable-exception-classes>
<include class="java.lang.Exception" />
</skippable-exception-classes>
</chunk>
<listeners>
<listener ref="skipListener" />
</listeners>
</tasklet>
</step>
Run Code Online (Sandbox Code Playgroud)
我读了一些论坛,并在两个级别上互换了listeners-tag:在chunk内部,在tasklet之外.没有什么工作......
在这里添加我的跳过侦听器
package com.legal.batch.core;
import org.apache.commons.lang.StringEscapeUtils;
import org.springframework.batch.core.SkipListener;
import org.springframework.jdbc.core.JdbcTemplate;
public class SkipListener implements SkipListener<Object, Object> {
@Override
public void onSkipInProcess(Object arg0, Throwable arg1) {
// TODO Auto-generated method stub
}
@Override
public void onSkipInRead(Throwable arg0) {
}
@Override
public void onSkipInWrite(Object arg0, Throwable arg1) {
}
}
Run Code Online (Sandbox Code Playgroud)
专家请建议
许多论坛已经多次询问过这个问题.但我没有看到适合我的答案.我试图在我的春季批处理实现中实现多线程步骤.
有一个包含100k记录的临时表
想要在每个线程的10个提交间隔300个线程中处理它 - 所以在任何时间点都有3000个记录.
我定义了一个任务执行器,并在我想要多线程的步骤中引用它
我的想法是,首先我将获得线程池大小(10)并使用velue(可以是1-10)更新thread_id列到每个100k记录.在这种情况下有10个线程和100k记录,所以10k记录将分配一个id - 我正在尝试实现一个stagingsteplistener来执行此操作.
为这个临时表写了一个读者.任务执行器将创建10个读者,每个读者必须读取300个不同的记录并处理它们 - 现在我如何在步骤监听器和读取器之间传递一个公共ID,以便每个线程都有自己的一组记录来处理.
截至目前,我只有一个JVM.所以我想在Multi Threaded步骤中做这个,而不是考虑基于分区的方法.
请帮忙......
我提到了pro spring批处理书并创建了一个临时步骤监听器,它使用作业参数从作业配置xml接受运行ID,如下所示
<beans:bean id="stagingStepListener"
class="com.apress.springbatch.statement.listener.StagingStepListener" scope="step">
<beans:property name="dataSource" ref="dataSource"/>
<beans:property name="tableName" value="transaction"/>
<beans:property name="whereClause"
value="where jobId is null and processed is null"/>
<beans:property name="jobId" value="#{jobParameters[run.id]}"/>
</beans:bean>
Run Code Online (Sandbox Code Playgroud)
我找不到的是这个?这个"run.id"来自哪里.我在书中的任何地方都没有看到.我在我的spring批处理中复制了相同的实现,当我运行它时,我看到异常说run.id是不可识别的.请帮我讲一下如何做到这一点?
我写了一个REST调用,它会在调用时返回健康状态
@RestController
@RequestMapping(value = "/account")
public class HealthCheckController {
protected final Logger log = LoggerFactory.getLogger(this.getClass());
@RequestMapping(value = "/health", method = RequestMethod.GET, produces = { "application/json" })
@ResponseStatus(HttpStatus.OK)
@ApiOperation(value = "Returns the health status of the application", notes = "Load balancer user this to confirm the health of the node")
public @ResponseBody String getHealth(HttpServletRequest request, HttpServletResponse response) throws Exception {
log.info("***" + RequestCorrelation.getId() + "***" + "HealthCheckController - getHealth () Called");
return "{\"health\":{\"SERVICES\":\"OK\"}}";
}
}
Run Code Online (Sandbox Code Playgroud)
当我以招摇或邮差打开它时,它会返回正确的响应.但是,当我在Chrome浏览器中点击此URL时,我看到了
This page contains the following …Run Code Online (Sandbox Code Playgroud) 我需要编写一个实用程序,它接受一个空白的HashMap和任何对象作为参数并返回HashMap
public HashMap returnMap(HashMap map,Object parseThisObject){
//logic to strip all children, children of children...... and place it in HashMap
//return map
}
Run Code Online (Sandbox Code Playgroud)
这个对象包含很多对象,其中的对象有很多子对象,并且继承了这个对象.
我的实用程序必须足够通用,以递归方式读取所有子项,直到它到达每个对象中的基元,将每个对象放在hasp映射中并将其返回.这就像父母会在地图中出现的那样.但是,个别孩子也会在地图中作为后续条目出现.
我是java反射的新手,我在网上浏览了一些教程和示例.对如何进行不太自信.我相信这是专家和专业人士可能面临的经常需求之一.
请帮助我解决这个问题.如果有任何bean实用程序开源可用吗?如果是的话请告诉我.
update mytable set node_index=0 where id in (
SELECT
id
FROM mytable
WHERE
rownum<=10 and PROCS_DT is null
order by CRET_DT,PRTY desc)
Run Code Online (Sandbox Code Playgroud)
这是我得到的错误
Error report:
SQL Error: ORA-00907: missing right parenthesis
00907. 00000 - "missing right parenthesis"
*Cause:
*Action:
Run Code Online (Sandbox Code Playgroud)
怎么了?专家请帮助..我是Oracle 11g的新手
我是java.util.concurrent包的新手,并编写了一个从DB中获取一些行的简单方法.我确保我的数据库调用会抛出异常来处理它.但我没有看到异常传播给我.而是调用我的方法返回null.
在这种情况下,有人可以帮助我吗?这是我的示例方法调用
private FutureTask<List<ConditionFact>> getConditionFacts(final Member member) throws Exception {
FutureTask<List<ConditionFact>> task = new FutureTask<List<ConditionFact>>(new Callable<List<ConditionFact>>() {
public List<ConditionFact> call() throws Exception {
return saeFactDao.findConditionFactsByMember(member);
}
});
taskExecutor.execute(task);
return task;
}
Run Code Online (Sandbox Code Playgroud)
我用Google搜索并找到了一些页面.但是没有看到任何具体的解决方案.专家请帮帮....
taskExecutor是org.springframework.core.task.TaskExecutor的对象
我想选择一些行,并在另一个线程到来之前立即将该行中的进程列更新为"Y".
如何在Oracle中执行此操作
最初我有一个select for update查询,它不起作用.在多线程模式下实现此目的的方法是什么?
我正在使用Oracle而无法在此论坛中找到与oracle相关的答案?
请帮忙
java ×5
spring ×3
spring-batch ×3
oracle11g ×2
rest ×2
spring-boot ×2
spring-mvc ×2
concurrency ×1
curl ×1
cygwin ×1
https ×1
jaxb ×1
object ×1
parsing ×1
reflection ×1
sql ×1
xjc ×1