小编jav*_*oob的帖子

需要示例程序才能抛出InterruptedException

我正在通过kathy sierra SCJP 1.5第9章(线程),它被提到:

请注意,sleep()方法可以抛出已检查的InterruptedException(您通常会知道这是否可能,因为另一个线程必须明确地执行中断),因此您必须使用句柄或声明来确认异常

我只需要一个示例程序来了解它何时发生(我可以在我的机器上运行)?

我用Google搜索但找不到任何示例代码来测试此功能..

提前致谢

java multithreading

6
推荐指数
1
解决办法
1万
查看次数

为什么setDisallowedFields为id? - Spring petclinic的例子

从Spring API,我明白@InitBinder用于初始化一些绑定规则..

在petclinic的例子中为什么我们有setdisallowed("id")?当id没有显示在表单上时?

@InitBinder
public void setAllowedFields(WebDataBinder dataBinder) {
    dataBinder.setDisallowedFields("id");
}
Run Code Online (Sandbox Code Playgroud)

id字段没有显示在网页上,那么为什么我们使用上面的代码呢?

我们可以有这样的事情:

@InitBinder
public void setAllowedFields(WebDataBinder dataBinder) {
    dataBinder.setDisallowedFields("FirstName");
}
Run Code Online (Sandbox Code Playgroud)

根据上面的代码,虽然用户在表单上输入,但不会设置所有者对象的名字字段?那是对的吗?

链接源

spring spring-mvc

6
推荐指数
1
解决办法
2491
查看次数

svn update <directory> -r HEAD --force仍然保留本地文件的脏副本

我想每天更新到最新版本的selenium代码(http://selenium.googlecode.com/svn/trunk).

我只是在我的eclipse中选择文件夹,右键单击,团队并选择更新到HEAD.Buty,这会留下一些目录和文件的脏副本.

我正在寻找的是:我总是希望检查从存储库到本地目录的最新代码,覆盖本地更改,如果有的话

注意:我没有提交权限,我只是希望存储库中的最新代码覆盖我的本地更改.

eclipse svn

6
推荐指数
1
解决办法
5656
查看次数

在Eclipse的eclipse中没有语法高亮显示

我日食中的java文件中没有语法突出显示.这突然发生了......不知道为什么..

这就是它现在的样子..

在此输入图像描述

正如在其他帖子中提到的..我试图改变首选项窗口的颜色,当我输入java时,什么都没有...真的搞砸了......

在此输入图像描述

AAny建议..

更新:

似乎Java插件没有安装..按照下面的screeenshot

在此输入图像描述

当我尝试安装java插件时,它表示已根据下面的屏幕截图安装了新版本

在此输入图像描述

java eclipse editor

6
推荐指数
1
解决办法
4314
查看次数

无法使用Spring创建Innerbean - BeanInstantiationException未找到默认构造函数

我从Spring reference 3.0开始学习spring,我想尝试如何实例化内部bean:

这是我的代码:

package com.springexample;

public class ExampleBean {

 private String samplePropertyExampleBean;

 public void setSamplePropertyExampleBean(String samplePropertyExampleBean) {
  this.samplePropertyExampleBean = samplePropertyExampleBean;
 }

 public String getSamplePropertyExampleBean() {
  return samplePropertyExampleBean;
 }

 class InnerBean{

  private String sampleProperty;

  public void setSampleProperty(String sampleProperty) {
   this.sampleProperty = sampleProperty;
  }

  public String getSampleProperty() {
   return sampleProperty;
  }

 }


}
Run Code Online (Sandbox Code Playgroud)

我的配置文件是:

当我试图检索bean InnerBean时,我收到以下错误:

线程"main"中的异常org.springframework.beans.factory.BeanCreationException:创建类路径资源[spring-config.xml]中定义名为'InnerBean'的bean时出错:bean的实例化失败; 嵌套异常是org.springframework.beans.BeanInstantiationException:无法实例化bean类[com.springexample.ExampleBean $ InnerBean]:找不到默认构造函数; 嵌套异常是java.lang.NoSuchMethodException:com.springexample.ExampleBean $ InnerBean.()

可能是什么问题呢?我尝试在InnerBean中添加无参数构造函数仍然我收到错误..

谁能帮我?

java spring

5
推荐指数
1
解决办法
7266
查看次数

为什么autodetect选项不适用于我?

我正在尝试使用autowire ="autodetect"..

在eclipse中,代码建议不会向我显示自动检测作为选项.但是它显示了其他值,如byname,bytype,constructor ..

我的申请中缺少什么?

java eclipse spring

5
推荐指数
1
解决办法
2144
查看次数

左外连接oracle中的三个表

我有三个表,如下所示:

在此输入图像描述

我想获得如下输出:

在此输入图像描述

这是我到现在为止所尝试的

    SELECT table1.tb1_a,
CASE WHEN table3.tb3_a IS NOT NULL THEN
    tb3_b
    ELSE 'No city for him yet'
END AS 'City'
FROM table1
LEFT OUTER JOIN table2 ON
    table1.tb1_a = table2.tb2_a
LEFT OUTER JOIN table3 ON
    table2.tb2_a = table3.tb3_a
WHERE table3.tb3_a IN
    (

    )
Run Code Online (Sandbox Code Playgroud)

现在我正在努力研究如何选择tb3_a列的最大值

sql oracle

5
推荐指数
1
解决办法
6124
查看次数

如何扩展 jar 文件中存在的类?

我有一个关于如何扩展 jar 文件中存在的 .class 的基本问题?

例如,我library.jar的构建路径上有文件,在这个 jar 文件中有一个类ClassA.class

当我尝试在 Eclipse 中执行此操作时

public class ClassAImpl extends ClassA{
}
Run Code Online (Sandbox Code Playgroud)

它显示错误,指出找不到 ClassA。

这是否意味着我必须下载源代码library.jar并将其添加到我的项目中?

不确定我的问题是否足够清楚?

java overriding jar class

5
推荐指数
1
解决办法
5656
查看次数

使用Spring AOP的BeanNotOfRequiredTypeException

我正在春天aop和spring配置文件下面尝试我的手:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:util="http://www.springframework.org/schema/util" xmlns:aop="http://www.springframework.org/schema/aop"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
        http://www.springframework.org/schema/aop  http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">

    <bean id="eddie" class="com.springinaction.Instrumentalist">
        <property name="instrument" ref="violin"></property>
        <property name="song" value="Samarame"></property>

    </bean>


    <bean id="kenny" class="com.springinaction.Instrumentalist">
        <property name="song" value="SAMARAME "></property>
        <property name="instrument" ref="saxopone"></property>
    </bean>

    <bean id="hank" class="com.springinaction.OneManBand">
        <property name="instruments">
            <props>
                <prop key="GUITAR">STRUM STRUM STRUM</prop>
                <prop key="CYMBAL">CRASH CRASH CRASH CRASH</prop>
                <prop key="HARMONICA">HUM HUM HUM</prop>
            </props>
        </property>
    </bean>

    <bean id="guitar" class="com.springinaction.Guitar">
    </bean>

    <bean id="violin" class="com.springinaction.Violin">
    </bean>

    <bean id="tabala" class="com.springinaction.Tabala">
    </bean>

    <bean id="saxopone" class="com.springinaction.Saxophone">
    </bean>

    <bean id="audience" class="com.springinaction.Audience"></bean> …
Run Code Online (Sandbox Code Playgroud)

java spring spring-aop

3
推荐指数
1
解决办法
6064
查看次数

css pdf page - 与内容重叠的标题

在此输入图像描述

正如我们从图像中看到的那样,我的内容与标题图像重叠,这就是我的代码:

    <style type="text/css" media="print">
        @page {
            /*size:landscape;*/

            @top-center {
                content: element(header);
            }
            @bottom-left {
                content: element(footer);
            }
        }
        div.header {
            padding: 10px;
            position: running(header);
        }
        div.footer {
            display: block;
            padding: 5px;
            position: running(footer);
        }
        .pagenumber:before {
            content: counter(page);
        }
        .pagecount:before {
            content: counter(pages);
        }
    </style>
</head>
<div class="header">
    <img src="logo.png" title="logo" width="200px"/>
</div>
<div class="content">

</div>
Run Code Online (Sandbox Code Playgroud)

PS:请不要将此问题视为重复,因为我已经搜索了与此相关的所有问题,但我的内容看起来与PDF有所不同.

html css pdf flying-saucer

3
推荐指数
1
解决办法
4540
查看次数