草庐IT

MAX_NUM_IMAGES_PER_CLASS

全部标签

spring - 得到错误 : Could not load JDBC driver class [org. postgresql.Driver]

我正在尝试运行Junit测试,之前只配置了没有maven的项目,现在我正在尝试进行此集成,但我在以下错误中停止:java.lang.IllegalStateException:FailedtoloadApplicationContextatorg.springframework.test.context.TestContext.getApplicationContext(TestContext.java:157)atorg.springframework.test.context.support.DependencyInjectionTestExecutionListener.inje

java - Spring Boot ConflictingBeanDefinitionException : Annotation-specified bean name for @Controller class

我的Spring引导应用程序中不断收到ConflictingBeanDefinitionException错误。我不完全确定如何解决它,我有几个@Configuration注释类帮助设置Thymeleaf、SpringSecurity和Web。为什么应用程序尝试设置homeController两次?(它在哪里尝试这样做?)错误是:org.springframework.beans.factory.BeanDefinitionStoreException:Failedtoparseconfigurationclass[org.kemri.wellcome.hie.Application]

java - Spring Boot ConflictingBeanDefinitionException : Annotation-specified bean name for @Controller class

我的Spring引导应用程序中不断收到ConflictingBeanDefinitionException错误。我不完全确定如何解决它,我有几个@Configuration注释类帮助设置Thymeleaf、SpringSecurity和Web。为什么应用程序尝试设置homeController两次?(它在哪里尝试这样做?)错误是:org.springframework.beans.factory.BeanDefinitionStoreException:Failedtoparseconfigurationclass[org.kemri.wellcome.hie.Application]

java - 如何为需要 MyClass.class 参数的工厂方法注入(inject) Spring Bean

我正在尝试将java.util.prefs.Preferencesbean注入(inject)到我的主Controller中。Controller看起来像:@ControllerclassMyController{@AutowiredprivatePreferencespreferences;}application-context.xml文件为java.util.prefs.Preferences创建bean。它使用工厂方法,所以我有以下条目来创建bean:Preferences.userNodeForPackage(param)将与Preference相关的类作为参数。在这种情况下

java - 如何为需要 MyClass.class 参数的工厂方法注入(inject) Spring Bean

我正在尝试将java.util.prefs.Preferencesbean注入(inject)到我的主Controller中。Controller看起来像:@ControllerclassMyController{@AutowiredprivatePreferencespreferences;}application-context.xml文件为java.util.prefs.Preferences创建bean。它使用工厂方法,所以我有以下条目来创建bean:Preferences.userNodeForPackage(param)将与Preference相关的类作为参数。在这种情况下

Spring 我应该在每个类(class)上使用@DirtiesContext

我有几个junit测试,@ContextConfiguration(locations={"file:../business/src/test/resources/application-context-test.xml","file:src/main/webapp/WEB-INF/confA.xml","classpath:/mvc-dispatcher-servlet-test.xml"})@WebAppConfiguration@RunWith(SpringJUnit4ClassRunner.class)publicclassProductContentControllerTes

Spring 我应该在每个类(class)上使用@DirtiesContext

我有几个junit测试,@ContextConfiguration(locations={"file:../business/src/test/resources/application-context-test.xml","file:src/main/webapp/WEB-INF/confA.xml","classpath:/mvc-dispatcher-servlet-test.xml"})@WebAppConfiguration@RunWith(SpringJUnit4ClassRunner.class)publicclassProductContentControllerTes

java.lang.IncompatibleClassChangeError : Implementing class Mongo

我无法弄清楚为什么会出现此错误。我尝试清理多余的库等等。当我尝试这样做时出现错误:mongo=newMongo(host,port);有趣的是,我可以运行从IDE(IntelliJ)制作的任何单元测试,但是当我尝试通过Tomcat运行它时,我得到了这个:Causedby:org.springframework.beans.BeanInstantiationException:Couldnotinstantiatebeanclass[com.sfatandrei.db.MongoManager]:Constructorthrewexception;nestedexceptionisjav

java.lang.IncompatibleClassChangeError : Implementing class Mongo

我无法弄清楚为什么会出现此错误。我尝试清理多余的库等等。当我尝试这样做时出现错误:mongo=newMongo(host,port);有趣的是,我可以运行从IDE(IntelliJ)制作的任何单元测试,但是当我尝试通过Tomcat运行它时,我得到了这个:Causedby:org.springframework.beans.BeanInstantiationException:Couldnotinstantiatebeanclass[com.sfatandrei.db.MongoManager]:Constructorthrewexception;nestedexceptionisjav

java - 什么是 "Aware"?我什么时候应该在我的类(class)名称中包含?

有时,我会发现一些类名称,包括Aware,例如ApplicationContextAware和MessageSourceAware(spring)。这条Aware有什么特殊含义,还是一条著名的规则? 最佳答案 那些不是类,是接口(interface)。这个名字只是Spring的一个约定,意思是一些特殊的框架对象将被注入(inject)到那个由框架管理的类中。直接来自ApplicationContextAware的文档:Interfacetobeimplementedbyanyobjectthatwishestobenotifiedo