![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
spring
脾气很倔呢
这个作者很懒,什么都没留下…
展开
-
cannot resolve symbol println
IntelliJ 无法快捷键输出System.out.println();并且即使手动输入也会报错cannot resolve symbol println()开发这么就,竟然犯了很二的错误。由于没写main函数导致的原因。估计今晚持续头脑发热没降下来。修改后的代码:原创 2017-08-08 22:42:38 · 10994 阅读 · 7 评论 -
cannot resolve symbol 'Api'
分析从提示中:出现这种提示是由于没有在pom.xml中添加此依赖包从颜色中:出现红色字体,我的经验是没有此包被引入到maven project中解决网上搜索@api发现他是属于swagger的注解,进而查询需要导入的包是什么当了解到需要导入的包是import io.swagger.annotations.*;时,查看我的项目maven project中并没有此包被导入,所以需要要pom.xml中添加原创 2017-08-15 16:14:08 · 8707 阅读 · 2 评论 -
could not autowire.No beans of 'FunctionService' type found.
could not autowire. No beans of ‘FunctionService’ type found.checks autowiring probleam in a been class 出现这种错误的可能性,目前我遇到的有两种可能性: 1. 没有把类注入为bean导致。即没有用注解@bean/@Named/@Service/@Component注入… 2. 如原创 2017-08-12 21:19:02 · 13350 阅读 · 5 评论 -
spring boot Configuration Annotation Proessor not found in classpath
@ConfigurationProperties(prefix = “author”) 没有指定classpath时,IDEA提示没有找到classpath。分析 出现spring boot Configuration Annotation Proessor not found in classpath的提示是在用了@ConfigurationProperties这个注解时,所以问题出现在Conf原创 2017-08-13 22:43:09 · 89612 阅读 · 23 评论 -
Property or field 'demoService1' cannot be found
从图片中可以看出,bean的名称默认是类名首字母小写 解决方法:修改demoService1为demoService @Value("#{demoService.str}") private String str;注意:注入其他bean的属性的访问方式:#{bean的name.属性} bean的名称是类名首字母小写,所以用类名访问也会报错,例如:用如下方原创 2017-08-13 14:50:07 · 186 阅读 · 0 评论 -
class path resource cannot be opened because it does not exits
E:\SoftwareTools\Java\jdk\bin\java ...八月 12, 2017 10:42:56 下午 org.springframework.context.annotation.AnnotationConfigApplicationContext prepareRefresh信息: Refreshing org.springframework.context.annota原创 2017-08-12 23:24:52 · 55294 阅读 · 3 评论 -
spring中@Configuration的重要性
代码: test.propertiesbook.name=javabook.author=jolieELConfig.javapackage com.yubai.EL;import org.apache.commons.io.IOUtils;import org.springframework.beans.factory.annotation.Autowired;import org.spr原创 2017-08-13 18:26:15 · 409 阅读 · 0 评论 -
cannot resolve symbol 'Resource'
再IntelliJ IDEA中,红色字体意味着此类的包没有import。 按快捷键提示:Shift + Ctrl + Enter可以查看到此类的相关的包 Alt + Enter 可以导入此包原创 2017-08-13 15:27:14 · 8593 阅读 · 1 评论 -
Property or field 'str' cannot be found on object of type 'com.yubai.EL.DemoService' - maybe not pub
警告: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ELConfig': Unsatis原创 2017-08-13 15:01:19 · 14351 阅读 · 0 评论 -
No qualifying bean of type 'com.yubai.bean.BeanWayService' available
警告: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'useBeanWayService'原创 2017-08-13 13:30:22 · 3109 阅读 · 0 评论 -
cannot resolve method,validates method refences in code configuration
从以上图片代码中可以看出,@Bean的initMethod和destoryMethod方法不是作用在定义init和destory的方法的类BeanWayService上,而是定义在了UseBeanWayService上导致的报错。解决办法:把方法的返回值类型修改为BeanWayService即可。如下图:原创 2017-08-13 12:02:31 · 2624 阅读 · 0 评论 -
Incompatible type.Found:'int',required:'java.lang.String'
spring的注解@Value不能注入int型的值,只能注入字符串,字符也不可以。从上图的代码提示中可以看出,value的值是String类型的原创 2017-08-12 22:10:27 · 18261 阅读 · 0 评论 -
Unused import statement
从图片中import导入的包的颜色中可以看出,没有用到的包颜色是灰色,用到的是黑色。再从提示中可以看出:未使用的导入语句原创 2017-08-12 21:32:37 · 6787 阅读 · 7 评论 -
spring快速入门(一)
使用maven构建的方式创建一个spring项目这是一个快速入门案例,本人不喜欢讲很多概念性的东西,看的让人一头雾水,最后花了老半天时间依然不懂。我的方式依然是先写一个快速入门案例,先明白框架的最简单的骨架,然后再系统的慢慢添加复杂的概念描述与详细用法。以下是spring的快速入门案例,贴上最喜欢的图片。基础配置spring快速入门基础配置1 jdk安装 2 maven下载spring快速入门创原创 2017-07-27 16:56:05 · 335 阅读 · 0 评论 -
No qualifying bean of type 'com.yubai.el.ELConfig' available
Aug 04, 2017 3:36:39 PM org.springframework.context.annotation.AnnotationConfigApplicationContext prepareRefreshINFO: Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContex原创 2017-08-04 15:45:27 · 745 阅读 · 0 评论 -
Unused import statement
出现这种提示说明,导入的包没有使用。可以移除。 例如:package com.yubai;import org.springframework.stereotype.Service;public class FunctionService { public String sayHello(String word){ return "hello:" + word; }原创 2017-08-09 22:56:41 · 35396 阅读 · 1 评论 -
spring boot Configuration Annotation Proessor not found in classpath
如下问题,见图片:@ConfigurationProperties(prefix = "book",locations = "classpath:book.properties")locations是红色字体,就是说ConfigurationProperties没有这个locations属性。解决方案:查看ConfigurationProperties的用法,或者ConfigurationPrope原创 2017-08-09 16:21:47 · 4545 阅读 · 0 评论 -
JAVA,同级包下的类引用不需要import
类ServiceResponse 的属性含有同级包下的属性类型为EServiceResPonseStatus类型的变量,此时并没有import引入,而只需要类EServiceResPonseStatus存在即可。如果EServiceResPonseStatus不存在,则会报错。报错信息: 解释:EServiceResPonseStatus 标志找不到,一般这种标志找不到的错误要么是没有创建此类或者原创 2017-08-23 10:33:23 · 22517 阅读 · 0 评论