南宁网站平台大专动漫设计有出路吗
web/
2025/10/4 14:05:24/
文章来源:
南宁网站平台,大专动漫设计有出路吗,joomla适合做什么网站,阿里云可以建设网站吗前些天发现了一个巨牛的人工智能学习网站#xff0c;通俗易懂#xff0c;风趣幽默#xff0c;忍不住分享一下给大家。点击跳转到教程。
1. 启动工程失败#xff0c;报错如题#xff1a;
A component required a bean of type gentle.test.Show that could not be found.…前些天发现了一个巨牛的人工智能学习网站通俗易懂风趣幽默忍不住分享一下给大家。点击跳转到教程。
1. 启动工程失败报错如题
A component required a bean of type gentle.test.Show that could not be found.
2. 原因有一个被我注入其它类的 业务类上没有给注解service 。
PS还有2种原因1) 要求 service 和 controller 需要在同一个包下 。2有可能没有引入依赖的服务bean。 此条来自评论中好心网友的分享。
此类没有在类上给注解
package gentle.test;import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;import java.util.Date;/*** author silence* date 2018/7/17 11:37*/
public class Show implements Job {private static Logger _log LoggerFactory.getLogger(Show.class);Overridepublic void execute(JobExecutionContext arg0) throws JobExecutionException {_log.info(\n\n-------------------------------\n It is running and the time is : new Date()\n-------------------------------\n);}}在此类注入了上面那个类 Show
package gentle.test;import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;public class UserSyncTask {private final Logger logger LoggerFactory.getLogger(this.getClass());ResourceSchedulerTest test;ResourceShow show;public void cronDepartmentsAndUsersJob() {logger.info(\n\n 定时--开始当前时间 dateFormat().format(new Date()));
// test.addJob();try {show.execute(null);} catch (JobExecutionException e) {e.printStackTrace();}logger.info(\n\n 定时--结束当前时间 dateFormat().format(new Date()));}private SimpleDateFormat dateFormat() {return new SimpleDateFormat(HH:mm:ss);}
}3.解决在 Show 类上加上 service 注解 。
改为
package gentle.test;import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;import java.util.Date;/*** author silence* date 2018/7/17 11:37*/
Service(show)
public class Show implements Job {private static Logger _log LoggerFactory.getLogger(Show.class);Overridepublic void execute(JobExecutionContext arg0) throws JobExecutionException {_log.info(\n\n-------------------------------\n It is running and the time is : new Date()\n-------------------------------\n);}}4. 启动并运行定时任务正常
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/86816.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!