eclipse遇见错误总结

Caused by: java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:158)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:329)

配置文件找不到:	 
解决:
右键项目---->properties--->Java Build Path--->source--->Add Folder --->选择conf文件夹

Caused by: java.lang.NoSuchMethodException: com.mod.Person.()
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getDeclaredConstructor(Unknown Source)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:80)
… 14 more

解决:
在bean类里面加一个无参的构造方式即可
例:
public Person() {
	super();
	// TODO Auto-generated constructor stub
}

Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property ‘jdbcurl’ of bean class [com.alibaba.druid.pool.DruidDataSource]: Bean property ‘jdbcurl’ is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1076)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:927)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:95)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:75)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1510)
… 41 more“

Druid的数据源的
<property name="url" value="${jdbc.url}"></property>
<property name="username" value="${jdbc.username}"></property>
<property name="password" value="${jdbc.password}"></property>
的name属性的值要改成指定名称。比如:把jdbcurl换成url、username必须一样、password也是

通配符的匹配很全面, 但无法找到元素 'context:property-placeholder' 的声明。

在Spring配置文件中出现通配符的匹配很全面, 但无法找到元素 'context:property-placeholder' 的声明这个错误,其实主要是我们在引入命名空间时没有正确引入它的DTD解析文件,当然你必须在把Spring相应的包导入正确的情况下。
  解决方案就是如下:
xmlns:context="http://www.springframework.org/schema/context"
同时在xsi:schemaLocation这个字符串中添加context相关的解析文件
http://www.springframework.org/schema/context
              http://www.springframework.org/schema/context/spring-context-4.2.xsd。
其他的如util命名空间导入方式一样,只是把context换成相应util就可以了。

Exception in thread “main” org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘userController’ is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:638)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1159)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:282)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:979)
at com.spring.test.test.main(test.java:11)

没有任何一个bean可以为他自动装配,要么没加注解要么配置文件中包写错了

Caused by: java.lang.IllegalArgumentException: Pointcut is not well-formed: expecting ‘)’ at character position 16
exection(public int com.spring.aop.aspectj.mathImpl.add(int, int))
^^^

注解中写错了,execution写成exection了
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值