如果我可以使用Java 8 Date and Time API(java.time),有没有理由使用Joda Time ?
我应该每次都使用Java 8日期和时间吗?
我想在Spring XML配置文件中定义默认属性值.我想要这个默认值null.
像这样的东西:
...
<ctx:property-placeholder location="file://${configuration.location}"
ignore-unresolvable="true" order="2"
properties-ref="defaultConfiguration"/>
<util:properties id="defaultConfiguration">
<prop key="email.username" >
<null />
</prop>
<prop key="email.password">
<null />
</prop>
</util:properties>
...
Run Code Online (Sandbox Code Playgroud)
这不起作用.甚至可以null在Spring XML配置中定义属性的默认值吗?
我需要以编程方式在JSF 2中创建复合组件.经过几天的搜索和实验,我找到了这种方法(在java.net上受到Lexi的启发):
/**
* Method will attach composite component to provided component
* @param viewPanel parent component of newly created composite component
*/
public void setComponentJ(UIComponent viewPanel) {
FacesContext context = FacesContext.getCurrentInstance();
viewPanel.getChildren().clear();
// load composite component from file
Resource componentResource = context.getApplication().getResourceHandler().createResource("whatever.xhtml", "components/form");
UIComponent composite = context.getApplication().createComponent(context, componentResource);
// push component to el
composite.pushComponentToEL(context, composite);
boolean compcompPushed = false;
CompositeComponentStackManager ccStackManager = CompositeComponentStackManager.getManager(context);
compcompPushed = ccStackManager.push(composite, CompositeComponentStackManager.StackType.TreeCreation);
// Populate the component with value expressions
Application application = context.getApplication();
composite.setValueExpression("value", …Run Code Online (Sandbox Code Playgroud) 似乎新的java.timeAPI提供了所有内容java.util.Date以及更多内容.自Java 8以来新的API出现时
是否有任何理由使用?应和完全避免?java.util.Datejava.timejava.util.Datejava.util.Calendar
例如,可以在没有生成元模型的情况下使用JPA Criteria API.类型安全性已丢失,但我可以在运行时仅使用反射而无需事先了解数据模型的情况下创建查询.我想以同样的方式使用Querydsl.我不关心类型安全,因为我无论如何都不知道数据模型.
在我最近的项目中,我想主要使用Querydsl,因为它构成了持久性的另一层.所以我希望在JPA,JDO,JDBC,Lucene,Hibernate Search,MongoDB,Collections和RDFBean上使用相同的查询.
或者有Querydsl的替代方案可以用上述方式使用吗?
由于NoSQL DB正在上升.是否有任何其他框架构成了各种持久性提供程序上的类似抽象层?
我写了一个aspectj类,我想通过自动检测编织
但它没有效果.显示一些错误:
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.struts2.dispatcher.RequestMap
when weaving classes
when weaving
[Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.struts2.dispatcher.SessionMap
when weaving classes
when weaving
[Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving classes
when weaving
[Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.struts2.util.AttributeMap
when weaving classes
when weaving
[Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of …Run Code Online (Sandbox Code Playgroud) 在我的项目中,我有maven依赖性。
顺便说一下:
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-activiti</artifactId>
<version>3.2.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
在此依赖项POM中,有一个已使用但未定义的属性- ${activiti.version}
我发现如何设置此属性的唯一方法是在命令行上指定它,例如 mvn -Dactiviti.version=5.10
有什么方法可以在我的项目POM中指定此属性吗?
<properties><activiti.version>5.10</activiti.version></properties>不起作用。
我希望我已经把问题弄清楚了。
感谢帮助。
编辑:
如果您创建具有依赖关系的新Maven项目,则可以重现我尝试解决的情况:
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-activiti</artifactId>
<version>3.2.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
并提供所需的存储库:
<repositories>
<repository>
<id>muleforge-repo</id>
<name>MuleForge Repository</name>
<url>http://repository.muleforge.org/release</url>
<layout>default</layout>
</repository>
<repository>
<id>codehaus-repo</id>
<name>Codehaus Repository</name>
<url>http://dist.codehaus.org/mule/dependencies/maven2</url>
<layout>default</layout>
</repository>
<repository>
<id>activiti</id>
<name>Activiti</name>
<url>https://maven.alfresco.com/nexus/content/groups/public/</url>
</repository>
</repositories>
Run Code Online (Sandbox Code Playgroud)
编辑2:
这里是一个POM为org.mule.modules:骡子模块的Activiti:3.2.0,图书馆我的项目依赖。在这个pom内部,他们使用expression ${activiti.version}。但是他们没有为这个表达式设置值。(没有类似的东西<properties><activiti.version>5.10</activiti.version></properties>)
问题是我怎么可以从这个表达式设定值我 POM?