我正在尝试使用Spring Data和Neo4j.我开始尝试按照主站点链接的本指南.特别是我将我的pom.xml基于"Hello,World!".示例文件.这是我的pom.xml中针对导致问题的插件的剪辑...
<plugin>
<!-- Required to resolve aspectj-enhanced class features -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<outxml>true</outxml>
<aspectLibraries>
<aspectLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</aspectLibrary>
<aspectLibrary>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
</aspectLibrary>
</aspectLibraries>
<source>1.6</source>
<target>1.6</target>
</configuration>
<executions>
<!-- ERROR HERE IN ECLIPSE SEE BELOW FOR FULL MESSAGE -->
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我看到的错误是:
Multiple annotations found at this line:
- Plugin execution not covered by …Run Code Online (Sandbox Code Playgroud) 我有一个表Stuff定义为......
id, <fields>..., active
Run Code Online (Sandbox Code Playgroud)
Active是软删除标志,总是1或0.从长远来看,这可能会有利于历史表.
public interface StuffRepository extends JpaRepository<StuffEntity, Long> {}
Run Code Online (Sandbox Code Playgroud)
在代码中,我们总是 使用活动记录.有没有办法让Spring始终active=1为为此存储库生成的查询附加条件?或者更理想的是允许我扩展用于生成查询的语法?
我知道我可以@queues在任何地方创建命名,但后来我失去了生成的查询的便利性.我还想避免使用"主动"方法污染接口.
我正在使用Hibernate 4.2作为我的JPA实现,如果这很重要的话.
谷歌的Chrome和IE等应用程序可以透明地处理Kerberos身份验证; 但是,我无法找到一个"简单"的Java解决方案来匹配这种透明度.我发现的所有解决方案都需要存在krb5.conf文件和login.conf文件,而上述应用程序似乎需要这些文件.
使用Kerberos SSO功能构建Java应用程序的最佳方法是什么?
[更新]:要明确我需要一个CLIENT端解决方案来创建不验证它们的票证.此外,似乎SPNEGO是默认的"包装器"协议,最终将委托给Kerberos,但我也需要能够处理SPNEGO协议.
我需要stackoverflow的一些智慧.
我将开发一个GUI应用程序,它将通过表单处理xml数据.我选择了两个选项:Java(swing或swt)或Qt.
我已经尝试过Qt(Qt设计师)和Java(Eclipse)的基础教程.我必须承认,两者都将满足我的需求.
我要解决的最后一个问题是部署会有多痛苦?
最终用户是非技术人员,因此安装和更新过程必须简单.
Java具有Java Web Start,易于更新; 如果没有JVM需要,Qt可能会更"打包".
你怎么看 ?优缺点都有什么 ?
非常感谢
这几乎看起来很傻但是关闭OutputStream时最可靠的模式是什么?现在我有类似下面的东西,似乎是try-catch-finally-overkill:
private void writeContentsToFile(OutputStream ostream, Properties contents) {
try {
contents.store(ostream, "comments");
}
catch (IOException e) {
throw new ResourceException("Failed to write contents", e);
}
finally {
try {
ostream.close();
}
catch (IOException e) { /* what can be done here anyway? */ }
}
}
Run Code Online (Sandbox Code Playgroud)
为什么近距离抛出一个经过检查的异常对我来说仍然是一个谜.我可以创建执行close/catch块的包装器方法,但是如果有某些东西已经存在,就像FileUtil.closeFileAndThrowUncheckedException()我想要使用它一样.当你有很多具有大量开发人员的小项目时,这会变得更有用; 一种方法是正确的.
在一个非常简单的HelloWorld应用程序上运行javap时,我对常量池周围的输出有些困惑.
测试代码
public class TestClass {
public static void main(String[] args) {
System.out.println("hello world");
}
}
Run Code Online (Sandbox Code Playgroud)
Javap -c -verbose输出(剪切)
// Header + consts 1..22 snipped
const #22 = String #23; // hello world
const #23 = Asciz hello world;
public static void main(java.lang.String[]);
Signature: ([Ljava/lang/String;)V
Code:
Stack=2, Locals=1, Args_size=1
0: getstatic #16; //Field java/lang/System.out:Ljava/io/PrintStream;
3: ldc #22; //String hello world
5: invokevirtual #24; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
8: return
// Debug info snipped
}
Run Code Online (Sandbox Code Playgroud)
好的,所以在第3行我们看到通过#22将"hello world"常量推送到堆栈上,但const#23似乎保持实际值.我想我对#(数字)在打印输出右侧出现时的含义有点困惑.
Oracle/Sun的javap手册页有很多不足之处.
我有两个模块,组件和应用程序.由于构建过程中稍后的依赖性冲突(谷歌协议缓冲区),组件模块被着色.
<!-- snip from Component's pom.xml -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration>
<relocations>
<relocation>
<pattern>com.google.protobuf</pattern>
<shadedPattern>my.package.protocols.shaded.com.google.protobuf</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
应用程序取决于组件模块.但是,Application中的源文件无法引用Component所依赖的着色库.这对于与Component进行交互至关重要.
<-- snip from Application's pom.xml -->
<dependency>
<groupId>my-group</groupId>
<artifactId>component</artifactId>
<version>${project.version}</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
尽管IntelliJ无法找到导入,但Maven构建工作正常.我错过了什么/做错了什么?
在使用File.mkdir和朋友时,我注意到他们不会在失败时抛出异常!值得庆幸的是FindBugs指出了这一点,现在我的代码至少检查了返回值,但我仍然看不到有关调用失败原因的有意义信息!
如何找出调用这些File方法失败的原因?是否有一个很好的替代品或库来处理这个问题?
我已经在SO和Google上进行了一些搜索,并发现了关于此主题的令人惊讶的小信息.
[更新]我试过VFS,它的例外没有任何有用的信息.例如,尝试移动最近删除的目录导致Could not rename file "D:\path\to\fileA" to "file:///D:/path/do/fileB".无法提及fileA不再存在.
[更新]业务要求仅限于JDK 1.6解决方案,因此JDK 1.7已经淘汰
我知道LL与LR解析器的基本区别.我也知道GLR,SLR和LALR都是LR解析器的扩展.所以我的问题更多细节是......
给定一个LL(*)解析器和LR解析器的任何变体,是否有任何语言可以在一个而不是另一个中描述?或者更简单的是,是否有任何功能或属性无法表达?
作为一个具体的例子.如果我要使用LL(*)解析器创建一种语言,我是否会遇到我想要添加到我的语言中的所需功能/属性,这只能通过LR解析器实现(反之亦然)?
programming-languages parser-generator ll-grammar lr-grammar
更完整的问题是,给定一个期望回调作为参数的依赖项,如何编写覆盖回调逻辑的单元测试并仍设法模拟依赖项?
public class DoStuff {
public void runThis(Runnable callback) {
// call callback
}
}
public class ClassUnderTest {
private DoStuff stuffToDo;
public void methodUnderTest() {
this.stuffToDo.runThis(/*a runnable with some logic*/)
}
}
Run Code Online (Sandbox Code Playgroud)
在上面的例子中,我会模拟,stuffToDo因为我应该验证方法调用的调用和模拟输出.但是,runThis模拟导致回调逻辑未被测试.此外,回调逻辑似乎应该是私有的,所以我不希望直接测试它; 或许这对我来说是一种误解.
由于回调被相当广泛地使用,我希望有一种常用的方法来测试它们,但我还没有找到它.
java ×7
maven ×2
spring-data ×2
auto-update ×1
callback ×1
deployment ×1
eclipse ×1
filesystems ×1
javap ×1
jpa ×1
kerberos ×1
ll-grammar ×1
lr-grammar ×1
m2eclipse ×1
qt ×1
spring ×1
unit-testing ×1