我有一个java源文件夹,我希望从编译中排除.
我的文件夹在qa/apitests/src/main/java/api/test/omi.
我加在下面的项pom.xml下qa/bamtests,但它并没有帮助.除此之外我还需要制作一个条目吗?
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
<include>**/*.xsd</include>
<include>**/*.csv</include>
</includes>
<excludes>
<exclude>src/main/java/api/test/omi</exclude>
</excludes>
</resource>
</build>
Run Code Online (Sandbox Code Playgroud) 我有一个SQL列PROTOCOL,它可以为空并且在表上有约束
PROTOCOL IN (1, 2, 3)
Run Code Online (Sandbox Code Playgroud)
此外,因为它是可空的,我想设置并获取表中的空值
但我做不到setInt,getInt因为无效.如何使用JDBC将null设置为null
setInt(4,null);
Run Code Online (Sandbox Code Playgroud) 我试图了解工厂模式.如果有很多实现,那么我的工厂模式将有很多if else或switch情况.每次我介绍一个新的实现时,我都应该更改我的工厂代码
如下面的例子中如果让代表或切换案例,如果许多动物实现宠物界面我的工厂会如同许多动物实施宠物界面那么假设狗鸭正在实施宠物界面.有没有办法通过带来更多动态方法来解决这个问题?
package com.javapapers.sample.designpattern.factorymethod;
//Factory method pattern implementation that instantiates objects based on logic
public class PetFactory {
public Pet getPet(String petType) {
Pet pet = null;
// based on logic factory instantiates an object
if ("bark".equals(petType))
pet = new Dog();
else if ("quack".equals(petType))
pet = new Duck();
return pet;
}
Run Code Online (Sandbox Code Playgroud)
如果动物长大
if ("bark".equals(petType))
pet = new Dog();
else if ("quack".equals(petType))
pet = new Duck();
else if ("mno".equals(petType))
pet = new MNO();
else if ("jkl".equals(petType))
pet = new JKL(); …Run Code Online (Sandbox Code Playgroud) 我何时应该使用arrayList?何时应该使用LinkedList?
什么时候应该使用TreeSet,LinkedHashSet并HashSet?
我在spring中配置了一些调度程序.当我尝试启动我的Web应用程序时,它会抛出以下错误并停止.我的应用程序实际上并没有启动.我的调度程序看起来也是这样的,当我关闭tomcat时,一些石英线程没有关闭
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean" destroy-method="destroy">
<property name="triggers">
<list>
<ref bean="scheduler.localAdaptorCronTrigger"/>
</list>
</property>
</bean>
<bean id="localAdaptor" class="LocalAdaptor" />
<bean id="scheduler.localFSSlaAdaptorJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="Adaptor"/>
<property name="targetMethod" value="xxxxxx"/>
</bean>
<bean id="scheduler.localAdaptorCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="scheduler.localAdaptorJobDetail"/>
<!-- run every morning at 12 AM -->
<property name="cronExpression" value="0 0 0 * * ?"/>
</bean>
<bean id="scheduler.localFSSlaAdaptorSimpleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<!-- see the example of method invoking job above -->
<property name="jobDetail" ref="scheduler.localAdaptorJobDetail"/>
<!-- runs after 10 seconds for single time...-->
<property name="startDelay" value="1000"/>
<!-- repeated once --> …Run Code Online (Sandbox Code Playgroud) <int:poller fixed-delay="${fixedDelay}" default="true">
<int:advice-chain>
<ref bean="pollAdvise"/>
</int:advice-chain>
</int:poller>
<bean id="pollAdvise" class="org.springframework.integration.scheduling.PollSkipAdvice">
<constructor-arg ref="healthCheckStrategy"/>
</bean>
<bean id="healthCheckStrategy" class="test.main.ServiceHealthCheckPollSkipStrategy">
<property name="url" value="${url}"/>
<property name="doHealthCheck" value="${doHealthCheck}"/>
<property name="restTemplate" ref="restTemplate"/>
</bean>
<bean id="restTemplate"
class="org.springframework.web.client.RestTemplate">
<constructor-arg ref="requestFactory"/>
</bean>
<bean id="requestFactory"
class="test.BatchClientHttpRequestFactory">
<constructor-arg ref="verifier"/>
</bean>
Run Code Online (Sandbox Code Playgroud)
我的健康检查策略如下所示
@ManagedResource
public class ServiceHealthCheckPollSkipStrategy implements PollSkipStrategy {
private volatile boolean skip=false;
private String url;
private static String doHealthCheck;
private RestTemplate restTemplate;
public RestTemplate getRestTemplate() {
return restTemplate;
}
public void setRestTemplate(RestTemplate restTemplate) {
this.restTemplate = restTemplate;
}
public String getUrl() …Run Code Online (Sandbox Code Playgroud) 我想了解Java.
假设我ArrayList的大小为50,并预先填充了一些名称.
假设我从数组列表中删除了第3个和第4个元素.我的数组列表会发生什么?会重新排列吗?如果我尝试访问现在删除的第3和第4个元素,它会返回null吗?
我的表中有一列列名称是 INSTANCE_GUID 它的原始数据类型。
我正在编写一个准备好的语句选择查询并设置 INSTANCE_GUID
pstatement.setString(instanceGuid);
Run Code Online (Sandbox Code Playgroud)
但这是设置原始数据类型的正确方法吗?请让我知道如何设置原始数据类型,我应该使用 setByte 吗?
谢谢
我有一个java文件路径
/opt/test/myfolder/myinsidefolder/myfile.jar
我想替换的文件路径到这里的根路径将保持不变,但想从更改文件名myfile.jar来Test.xml
/opt/test/myfolder/myinsidefolder/Test.xml
我怎么能在java中做任何帮助?
我在perl中有一个子例程来检查数组是否包含特定元素,如果它包含返回TRUE,否则为false ..下面的代码应该重新返回false,因为搜索的元素http_TestABC不在数组中但仍然返回TRUE.无法解释为什么会发生这种情况任何指针表示赞赏谢谢
#!/usr/bin/perl
use strict;
use warnings;
my @result_listosp; # defines an empty array
$result_listosp[0] = "origin-server-pool-1"; # array has one element
$result_listosp[1] = "http-pool-OSP2"; # array has 10 elements now
my $osp="http_TestABC";
my $status_osp_check= check_if_entity_exists(@result_listosp,$osp);
print $status_osp_check;
sub check_if_entity_exists()
{
my @entityarray = @_;
my $entity = $_[1];
my $status="FALSE";
if ( grep( /^$entity$/, @entityarray ) ) {
$status="TRUE";
return $status;
}
else {
return $status;
}
}
Run Code Online (Sandbox Code Playgroud)