我正在使用注释来动态创建Bean,我收到以下错误.
package demoproject;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class ProductFactory {
public ProductFactory() {
// TODO Auto-generated constructor stub
}
@Bean
public Product josh(){
Product josh = new Battery();
josh.setId("cdrw");
josh.setPrice(100);
return josh;
}
}
Run Code Online (Sandbox Code Playgroud)
web.xml中
<!-- Bean for JavaConfig -->
<bean class='demoproject.ProductFactory' />
<!-- be sure to include the JavaConfig bean post-processor -->
<bean class="org.springframework.config.java.process.ConfigurationPostProcessor"/>
Run Code Online (Sandbox Code Playgroud)
错误日志
Exception in thread "main" org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.config.java.process.ConfigurationPostProcessor] for bean with name 'org.springframework.config.java.process.ConfigurationPostProcessor#0' defined in class path resource [web.xml]; nested exception …Run Code Online (Sandbox Code Playgroud) 我开始使用Hybris.我正在关注他们维基页面上的核心路径.我能够启动服务器,但是从一开始就突出的一件事是这个构建错误消息:
updateMavenDependencies:
[echo] C:\hybris\hybris\bin\platform\ext\core/web/webroot/WEB-INF/external-
dependencies.xml was not found!
Run Code Online (Sandbox Code Playgroud)
...在C:\ hybris\hybris\bin\platform\ext\core中,没有"web"目录(?)
上面的"web/webroot/WEB-INF/external-dependencies.xml找不到了!" 还没有解决....
下面是参考线程回答 - 谢谢!
但是直到"cuppy"演示我才得到这个春天的IOC错误没有运行时问题:
org.springframework.beans.factory.BeanCreationException: Error creating bean wit
h name 'openLigaDBTemplate' defined in class path resource [cuppy-ws-spring.xml]
: Instantiation of bean failed; nested exception is org.springframework.beans.Be
anInstantiationException: Failed to instantiate [org.springframework.ws.client.c
ore.WebServiceTemplate]: Constructor threw exception; nested exception is java.l
ang.NoSuchMethodError: org.springframework.util.ClassUtils.forName(Ljava/lang/St
ring;)Ljava/lang/Class;
Run Code Online (Sandbox Code Playgroud)
谢谢