我的应用程序运行但控制台中没有显示任何关于映射的信息。我的应用程序类文件在控制器之上,还添加了 @ComponentScan(basePackages : "com.org.name.controller") 来扫描控制器。仍然没有映射显示在控制台中。我在控制器类中注释掉了@Autowired,因为我收到以下错误:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-07-12 11:05:16.014 ERROR 14104 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Field userService in com.homzhub.lms.controller.UserController required a bean of type 'com.homzhub.lms.service.UserService' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type 'com.homzhub.lms.service.UserService' in your configuration.
主要类:
package com.homzhub.lms;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@ComponentScan(basePackages = {"com.homzhub.lms.controller"})
//@EnableJpaRepositories("repository")
//@EnableAutoConfiguration
public class LmsApplication{
public static void main(String[] args){
SpringApplication.run(LmsApplication.class, args);
}
}
预约控制器:
package com.homzhub.lms.controller;
import java.security.Principal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.homzhub.lms.entity.Appointment;
import com.homzhub.lms.entity.User;
import com.homzhub.lms.service.AppointmentService;
import com.homzhub.lms.service.UserService;
MYYA
互换的青春
绝地无双
慕工程0101907
相关分类