如何在Spring Framework中使用ORM ......?给我清楚的例子......
我们可以从非 osgi 组件访问 osgi 包,例如我们可以从非 osgi struts2 操作访问 osgi 包吗?如果是,那么如何提前感谢
我有一个简单的Camel应用程序捆绑包,该捆绑包将在Apache Service Mix 6.1下的Karaf 3.0.5中部署。配置文件放置在etc/目录中(假设它名为wf.cfg)。我想在我的应用程序包中具有动态配置更改功能。这样,无论何时更改了内容wf.cfg,都可以立即打包。为此,我在我的
blueprint.xml
<cm:property-placeholder persistent-id="wf"
update-strategy="reload">
<cm:default-properties>
<cm:property name="env" value="local" />
</cm:default-properties>
</cm:property-placeholder>
<!-- a bean that uses a blueprint property placeholder -->
<bean id="configBean" class="com.jabong.orchestratorservice.basecomponent.config.ConfigBean">
<property name="env" value="${env}" />
</bean>
Run Code Online (Sandbox Code Playgroud)
我现在面临的问题是如果将update-strategy设置为reload。然后,它似乎正在重新加载整个bean。
有人可以让我知道是否可以只重新加载configBean整个捆绑包吗?如果我能做到这一点,那么可能是我可以对configBean应用程序包可以使用的配置变量进行静态引用?
完整blueprint.xml的放在这里。
apache-camel apache-karaf aries blueprint-osgi apache-servicemix
如果我将Apache Ant添加到项目构建路径中,Apache Commons IO类是否可用?
我需要使用IOUtil类.如果没有请提供正确的JAR文件的下载链接.
在split方法中如果我只传递'+'字符,如下所示:
public class StringSplit {
public static void main(String[] str) {
String s1 = "test+plus";
String[] stArr = s1.split("+");
System.out.println(stArr.length);
for (int i = 0; i < stArr.length; i++) {
System.out.println(stArr[i]);
}
}
}
Run Code Online (Sandbox Code Playgroud)
以下错误即将发生:
Exception in thread "main" java.util.regex.PatternSyntaxException: Dangling meta character '+' near index 0
+
^
at java.util.regex.Pattern.error(Pattern.java:1713)
at java.util.regex.Pattern.sequence(Pattern.java:1878)
at java.util.regex.Pattern.expr(Pattern.java:1752)
at java.util.regex.Pattern.compile(Pattern.java:1460)
at java.util.regex.Pattern.<init>(Pattern.java:1133)
at java.util.regex.Pattern.compile(Pattern.java:823)
at java.lang.String.split(String.java:2292)
at java.lang.String.split(String.java:2334)
at StringSplit.main(StringSplit.java:5)
Run Code Online (Sandbox Code Playgroud)
但如果我用以下方法替换拆分呼叫:
String[] stArr = s1.split("\\+");
Run Code Online (Sandbox Code Playgroud)
它工作正常.
这种行为有什么理由吗?
为了模拟一些看起来像这样的自动生成的类,我创建了一个小的jUnit测试类来模拟继承和隐藏字段.
public class ClassDerivationTest {
@Test
public void testChild() {
ChildClass child = new ChildClass();
// Implicit boolean as it is hiding the super value
child.value = true;
// one way to update the parent value
// child.setParentVal("true");
// child.super.value = "test";
}
public class ChildClass extends ParentClass {
public boolean value;
}
public class ParentClass {
public String name;
public String value;
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是:是否有任何简短的方法来value以类似的方式分配超类字段:
child.super.value = "test";
Run Code Online (Sandbox Code Playgroud)
而不是在ChildClass中创建特定的setter:
// Imagine this method is not existing for …Run Code Online (Sandbox Code Playgroud) java ×4
ant ×1
apache-camel ×1
apache-karaf ×1
aries ×1
inheritance ×1
oop ×1
orm ×1
osgi ×1
osgi-bundle ×1
shortcut ×1
spring ×1
string ×1