小编Mar*_*ius的帖子

是否可以将OSGi与Spring Data集成?

我目前正在开发一个在使用JPA和QueryDSL的apache Karaf下运行的OSGi应用程序.

我想知道我是否可以使用SpringDS与QueryDSL而不是当前的方法.

这样做的原因是我发现Spring存储库非常有用,并且拥有NoSQL数据库访问模板将来可能会有用.

我试图在没有OSGi的Web上下文的情况下启动普通的spring应用程序,但是当它尝试加载applicationContext.xml或ApplicationContext.class时,我得到了一个ClassNoutFoundException.

我不想使用Spring DM,因为它已经停产.

基本上,想要尝试这种集成的唯一原因是Spring Repositories,但如果您认为这不是必要的,请告诉我.有关如何实现这一点的任何信息,或者是否可以继续这样做将非常受欢迎.

谢谢

更新

我已经设法通过启动应用程序上下文来使弹簧工作org.eclipse.gemini.blueprint.context.support.OsgiBundleXmlApplicationContext.applicationContext作为服务在OSGi中导出,我可以通过调用它来获取所需的所有bean.

我现在遇到的问题是,当我声明<jpa:repositories base-package="x.y.z" />我得到以下异常时:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' defined in URL [bundle://251.13:0/META-INF/spring/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.IllegalStateException: No persistence exception translators found in bean factory. Cannot perform exception translation.
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)[185:org.springframework.beans:3.1.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)[185:org.springframework.beans:3.1.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)[185:org.springframework.beans:3.1.4.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)[185:org.springframework.beans:3.1.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)[185:org.springframework.beans:3.1.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)[185:org.springframework.beans:3.1.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1109)[187:org.springframework.context:3.1.4.RELEASE]
    at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.registerBeanPostProcessors(AbstractDelegatedExecutionApplicationContext.java:502)[193:org.eclipse.gemini.blueprint.core:1.0.0.RELEASE]
    at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.registerBeanPostProcessors(AbstractDelegatedExecutionApplicationContext.java:451)[193:org.eclipse.gemini.blueprint.core:1.0.0.RELEASE]
    at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:306)[193:org.eclipse.gemini.blueprint.core:1.0.0.RELEASE]
    at org.eclipse.gemini.blueprint.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[193:org.eclipse.gemini.blueprint.core:1.0.0.RELEASE]
    at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:290)[193:org.eclipse.gemini.blueprint.core:1.0.0.RELEASE]
    at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:137)[194:org.eclipse.gemini.blueprint.extender:1.0.0.RELEASE]
    at java.lang.Thread.run(Thread.java:662)[:1.6.0_37]
Caused by: …
Run Code Online (Sandbox Code Playgroud)

spring osgi spring-data

15
推荐指数
2
解决办法
2498
查看次数

Eclipse:添加javadoc

我怎么能在eclipse中为不同的包添加javadoc.

举个例子:
我想在eclipse中为hibernate添加所有javadoc,但我不知道如何.我读过这篇文章如何在Eclipse中添加hibernate javadocs?但是我不想得到hibernate工具,因为我已经使用了STS而且我不理解其他评论.

我在Ubuntu上使用eclipse.

java eclipse spring hibernate javadoc

10
推荐指数
2
解决办法
2万
查看次数

Spring Boot MongoDb QueryDSL Gradle Intellij Integration用于生成QueryDSL Q类

我正在尝试使用Spring Boot项目中的gradle为我的Mongo实体生成QueryDSL Q类.我正在使用的IDE是Intellij.

我正在使用的代码改编自本主题从Gradle构建脚本生成JPA2 Metamodel:

sourceSets {
    generated {
        java {
            srcDirs = ['src/generated/java']
        }
    }
}

configurations {
    querydslapt
}

task generateQueryDSL(type: JavaCompile, group: 'build', description: 'Generates the QueryDSL query types') {
    source = sourceSets.main.java
    classpath = configurations.compile + configurations.querydslapt
    options.compilerArgs = [
            "-proc:only",
            "-processor", "org.springframework.data.mongodb.repository.support.MongoAnnotationProcessor"
    ]
    destinationDir = sourceSets.generated.java.srcDirs.iterator().next()
}

compileJava {
    dependsOn generateQueryDSL
    source  generateQueryDSL.destinationDir
}

compileGeneratedJava {
    dependsOn generateQueryDSL
    options.warnings = false
    classpath += sourceSets.main.runtimeClasspath
}

clean {
    delete sourceSets.generated.java.srcDirs
}

idea {
    module …
Run Code Online (Sandbox Code Playgroud)

intellij-idea mongodb gradle querydsl spring-boot

6
推荐指数
0
解决办法
436
查看次数

Spring Validator:同时具有注释和验证器实现

是否可以同时具有表单验证器和注释约束?

例如,在表单对象中具有以下字段:

@NotEmpty
private String date;
Run Code Online (Sandbox Code Playgroud)

但随后在验证器中验证日期的模式。

我知道这里有模式注释,但是我只想看看是否可以使用两种验证类型。

java spring annotations hibernate-validator bean-validation

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

无法使用gwt-maven-plugin在eclipse中创建项目

我去了新的>>其他>> maven项目>>选择nexus索引器或所有其他目录,但没有gwt-maven-plugin.我试图用愚蠢的细节添加它:

group id:org.codehaus.mojo

artifact id:gwt-maven-plugin

版本:2.4.0

存储库网址:repo1.maven.org

但我得到了以下错误:

"无法解析Archetype org.codehaus.mojo:gwt-maven-plugin:2.4.0 org.eclipse.core.runtime.CoreException:无法解析工件org.codehaus.mojo:gwt-maven-plugin:pom:2.4 .0"

有谁知道为什么会这样?谢谢

eclipse gwt plugins maven

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

将表单验证中生成的全局错误绑定到spring中的特定表单字段

有可能吗?
我做了一个检查,如果2场是由等于自定义注解这里.
我想验证字段"password"是否等于另一个字段"confirmedPassword".现在,如果不是,我希望显示链接到confirmedPassword字段的错误消息.我在jsp中显示错误<form:errors path="" />.还有另一种方法吗?另外也可能有这个注释另外2场emailconfirmedEmail.我怎么能区分哪个全局错误放在哪里......

我希望这一切都有道理..

binding spring

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

Spring获得所有@Entity类

有没有办法在Spring中获取所有@Entity类?我似乎无法找到任何解决方案.谢谢.

回答:

<dependency>
   <groupId>org.reflections</groupId>
   <artifactId>reflections</artifactId>
   <version>0.9.5</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

会轻易做到这一点;)

spring entity

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

如何将玉兰cms与spring mvc整合?

我正在尝试通过开花模块将我的spring应用程序与magnolia集成,但我无法理解如何执行此操作.

我已经阅读了很多关于这个主题的内容,但我实际上并不知道我的web.xml和applicationContext.xml应该是什么样子.

我的web.xml文件中是否应该有2个玉兰听众和春天的听众,并且有两个servlet用于开花,一个用于春天?然后我的applicationContext应该怎么样?

你能帮我提一下web.xml和applicationContext.xml的工作集成示例吗?我在网上到处都看,但web.xml无处可去.

非常感谢你 :)

java spring spring-mvc content-management-system magnolia

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