我是 Apache Camel 概念的新手。我曾尝试使用 apache camel API 编写示例代码,但在尝试运行代码时出现以下异常。
谁能帮我解决这个问题?
这是示例代码和一个例外,
示例代码:
CamelContext context = new DefaultCamelContext();
context.addRoutes(new RouteBuilder() {
public void configure() {
from("direct:start")
.setHeader(Exchange.HTTP_URI,simple("`http://sample-host:8080/demo/get`"))
.to("http://emptyhost");
}
});
context.start();
ProducerTemplate template = context.createProducerTemplate();
System.out.println(template.requestBodyAndHeaders("direct:start", null, null,String.class));
Run Code Online (Sandbox Code Playgroud)
例外 :
Exception in thread "main" org.apache.camel.FailedToCreateRouteException:
Failed to create route route1 at:
>>> To[`http://sample-host:8080/demo/get`] <<<
in route: Route(route1)
[[From[direct:start]] -> [`To[http://sample-host:8`…
because of
Failed to resolve endpoint: `http://sample-host:8080/demo/get`
due to:
No component found with scheme: http
Run Code Online (Sandbox Code Playgroud) 我不知道如何最好地描述我的问题,但在这里,我正在尝试从中删除相同的名称(值) HashMap<String, String> map = new HashMap<String, String>();
例如,如果这张地图包含这样的名字
map.put("Vivaldi","Antonio");
map.put("Belucci", "Monica");
map.put("Gudini", "Harry");
map.put("Verdo", "Dhuzeppe");
map.put("Maracci", "Bruno");
map.put("Carleone", "Vito");
map.put("Bracco", "Luka");
map.put("Stradivari", "Antonio");
Run Code Online (Sandbox Code Playgroud)
我想使用 method 从中删除所有值为“Antonio”的条目removeTheFirstNameDuplicates,我在谷歌上看了几天,所有的例子都接近我想要的,但并不是我真正需要的。
我的想法是,我需要一些东西来检查地图,如果其中包含相同的值,则删除重复项。但是我该怎么做呢?
我有一个表单处理Spring MVC控制器,带有JSR-303 bean验证@Valid.
整个处理GET程序的唯一目的是(几乎)相同POST,但省略@Valid注释以防止在提交表单之前<form:errors ...>在第一个用户GET请求中显示JSP中的错误.
我的问题是:
GET以干净的方式删除冗余方法?POST只做一个@Valid?这是我的示例代码:
@RequestMapping( value = "/account/register" , method = RequestMethod.GET )
public String registerGet( @ModelAttribute( "registerForm" ) RegisterForm registerForm ) {
return "account/register";
}
@RequestMapping( value = "/account/register" , method = RequestMethod.POST )
public String registerPost( @ModelAttribute( "registerForm" ) @Valid RegisterForm registerForm ,
BindingResult result ,
RedirectAttributes redirectAttributes ) {
... ADD USER HERE IF …Run Code Online (Sandbox Code Playgroud) 由于Java中没有自引用指针概念......如何解决此问题...
我不允许在Java中使用内置类链接列表...
但是"应该像在C中一样遵循链接列表的创建方法".什么可能是最好的替代节点 - >接下来,节点 - > Java中的prev ...
是否可以计算不应维护任何有状态变量的服务中的迭代次数?
@Service //stateless spring service singleton
class MyService {
//this is clearly not stateless
int iterations = 0;
ResultVO run() {
interations++;
do();
some();
subroutines();
if (validationFails() && iterations <= 3) {
run(); //retry the iteration steps only 3 times
} else {
throw TooManyIterationsException();
}
return resultVO;
}
}
Run Code Online (Sandbox Code Playgroud) Every day I update a csv file using a FileWriter. When we step into a new month I have to delete the data from the previous month. My below code only updates a data in a csv file so, please help in deleting the previous month's data.
At least I need to know how to delete the data in csv file using FileWriter, so that I can manage to code for deleting previous month data.
private static void …Run Code Online (Sandbox Code Playgroud) java ×6
spring ×2
apache-camel ×1
csv ×1
hashmap ×1
jsp ×1
linked-list ×1
loops ×1
spring-mvc ×1