使用Java Conf而不是xml配置Spring Wicket

我使用Spring很短的时间,但对于检票口我是新手。 但我想尝试一下这个框架。 我想配置这两个框架togheter。 但我想避免使用xml配置文件。 我知道wicket可以这样配置,根据这个: http://wicket.apache.org/guide/guide/single.html#helloWorld_2和此: https://github.com/bitstorm/Wicket-tutorial-examples/tree/master/SpringInjectionExample 但是现在我只得到错误: lis 15, 2014 4:31:15 PM org.apache.catalina.core.StandardContext filterStart SEVERE: Exception starting filter com.derp.wicket.ProjectFilter java.lang.NoSuchMethodError: org.apache.wicket.protocol.http.WebApplication.setMetaData(Lorg/apache/wicket/MetaDataKey;Ljava/lang/Object;)Lorg/apache/wicket/Application; at org.apache.wicket.spring.injection.annot.SpringComponentInjector.(SpringComponentInjector.java:115) at org.apache.wicket.spring.injection.annot.SpringComponentInjector.(SpringComponentInjector.java:92) at com.derp.wicket.WicketApplication.init(WicketApplication.java:52) at org.apache.wicket.Application.initApplication(Application.java:823) at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:424) at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:351) at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260) at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:105) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4603) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5210) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:581) at […]

在Java JFrame中显示Google日历

我在java jframe中显示谷歌日历时遇到问题。 编辑:我确实看到谷歌日历,但它有蓝色背景,这使得查看事件变得困难。 这是我的代码片段 temp是谷歌用户名。 private void getGoogleCalendar(){ googlepane=new JPanel(new BorderLayout()); String s=”https://www.google.com/calendar/b/0/htmlembed?src=groupboba@gmail.com&ctz=America/New_York&gsessionid=OK”; JEditorPane tp=new JEditorPane(); try { HTMLEditorKit kit = new HTMLEditorKit(); StyleSheet styles =kit.getStyleSheet(); styles.importStyleSheet(new URL(s)); kit.setStyleSheet(styles); kit.install(tp); tp.setContentType(“text/html”); tp.setEditorKit(kit); tp.addHyperlinkListener(this); tp.setEditable(false); tp.setPage(s); tp.setBackground(Color.white); } catch (IOException e) { e.printStackTrace(); } googlepane.add(tp, BorderLayout.CENTER); return; }

静态抽象方法解决方法

我想在abstract class创建一个abstract static method 。 我很清楚这个问题 ,这在Java中是不可能的。 什么是默认的解决方法/替代方式来思考问题/是否有一个选项可以为看似有效的示例(如下所示)执行此操作? 动物类和子类: 我有一个带有各种子类的基类Animal类。 我想强制所有子类能够从xml字符串创建一个对象。 对于这个,除了静态之外什么都没有意义呢? 例如: public void myMainFunction() { ArrayList animals = new ArrayList(); animals.add(Bird.createFromXML(birdXML)); animals.add(Dog.createFromXML(dogXML)); } public abstract class Animal { /** * Every animal subclass must be able to be created from XML when required * (Eg if there is a tag , bird would […]

java.lang.IllegalStateException:org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient中没有可用于学生服务的实例

我从link :: https://howtodoinjava.com/spring/spring-cloud/consul-service-registration-discovery/运行Spring Cloud Consule示例。 当我运行http:// localhost:8098 / getSchoolDetails / abcschool我收到以下错误,似乎客户端无法识别student-service 。 java.lang.IllegalStateException: No instances available for student-service at org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient.execute(RibbonLoadBalancerClient.java:75) ~[spring-cloud-netflix-core-1.3.1.RELEASE.jar:1.3.1.RELEASE] at org.springframework.cloud.client.loadbalancer.LoadBalancerInterceptor.intercept(LoadBalancerInterceptor.java:55) ~[spring-cloud-commons-1.2.2.RELEASE.jar:1.2.2.RELEASE] at org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:86) ~[spring-web-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.cloud.netflix.metrics.MetricsClientHttpRequestInterceptor.intercept(MetricsClientHttpRequestInterceptor.java:64) ~[spring-cloud-netflix-core-1.3.1.RELEASE.jar:1.3.1.RELEASE] at org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:86) ~[spring-web-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.http.client.InterceptingClientHttpRequest.executeInternal(InterceptingClientHttpRequest.java:70) ~[spring-web-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48) ~[spring-web-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53) ~[spring-web-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:652) ~[spring-web-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:613) ~[spring-web-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:559) ~[spring-web-4.3.9.RELEASE.jar:4.3.9.RELEASE] at com.example.howtodoinjava.springcloudconsulschool.delegate.StudentServiceDelegate.callStudentServiceAndGetData(StudentServiceDelegate.java:22) ~[classes/:na] at […]

合并不同语言的程序

我有三个程序(一个在C ++ + WinAPI中,另一个在C#.NET中,最后一个在Java中)具有不同的function。 我即将选择一个并实现其他两个的function。 有可能以某种方式合并它们吗? 我需要在一个GUI中,在一个过程中(至少在视觉上)将它们放在一起。 IPC不是问题。 谢谢你的一切

意图投入2个额外内容

我做了一个意图,我已经加入了2个额外内容 Intent intent = new Intent(MainActivity.this, Options.class); TextView labelName = (TextView) findViewById(R.id.label1); // value = “Counter1” TextView label2Name = (TextView) findViewById(R.id.label2); // value = “Counter 2” String lblNameDefault = labelName.getText().toString(); String lbl2NameDefault = label2Name.getText().toString(); intent.putExtra(LABEL_NAME_DEFAULT, lblNameDefault); intent.putExtra(LABEL_2_NAME_DEFAULT, lbl2NameDefault); 在我的其他活动中,我从这里检索信息 //Get name from the label Intent intent = getIntent(); String lblNameDefault = intent.getStringExtra(MainActivity.LABEL_NAME_DEFAULT); String lbl2NameDefault = […]

如何使用applet从java中的网络摄像头捕获video?

我喜欢使用java applet通过网络捕获和流式传输video。 到目前为止,看起来JMF已经过时,FMJ将无法以任何合理的速度捕获。 是否还有其他库可用于以至少每秒10-15帧的速度从网络摄像头捕获和传输video?

如何使用ListActivity列出android中数据库的post?

我正在尝试从数据库中检索数据并将它们列在android中,但我很困惑如何做到这一点所以我使用了listavtivity和其他一些PHP代码,但它没有作为应用程序工作。 崩溃我只是想问这是正确的方法吗? php代码: java代码: package com.listposts; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.ListActivity; import android.content.Intent; import android.net.ParseException; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast; public class SeeRequests extends ListActivity { InputStream […]

为什么组件扫描不适用于Spring Bootunit testing?

服务类FooServiceImpl使用@Service aka @Component进行注释,这使其有资格进行自动assembly。 为什么在unit testing期间没有拾取和自动assembly此类? @Service public class FooServiceImpl implements FooService { @Override public String reverse(String bar) { return new StringBuilder(bar).reverse().toString(); } } @RunWith(SpringRunner.class) //@SpringBootTest public class FooServiceTest { @Autowired private FooService fooService; @Test public void reverseStringShouldReverseAnyString() { String reverse = fooService.reverse(“hello”); assertThat(reverse).isEqualTo(“olleh”); } } 测试无法加载应用程序上下文, 2018-02-08T10:58:42,385 INFO Neither @ContextConfiguration nor @ContextHierarchy found for test […]

为Android应用程序存储ArrayList内容的最佳方法?

我知道在Android应用程序中有一些保存数据的方法,但我想知道什么是最简单和/或最有效的,或者换句话说哪种方法会在复杂性/合理性/性能的范围内胜出。 基本上我只有两个Class ArrayLists(类对象的ArrayLists,而不是原始数据类型)。 一个ArrayList的对象的构造函数有三个整数,另外四个。 我基本上需要存储那些整数的值(我有每个设置的方法以整数forms返回字符串或整数),并告诉每个整数属于哪个。 例如,如果我有:arrayListOne.get(1).getNumbers()返回1,2,3 arrayListTwo.get(1).getNumbers()返回1,2,3,4 以及一堆返回不同数字的其他索引,如何存储该数据,以便在应用程序关闭并重新启动时重新加载,并且值保持为初始化的索引?