idea+spring boot +mabitys(wanglezapin)+mysql (2)
实体类:
mapper.xml
mapper:
impl:
service:
package com.xingneng.lly.UserService; import java.util.List; public interface UserService { List findList(); List findGoback(); }
controller:
package com.xingneng.lly.UserController; import com.xingneng.lly.UserService.UserService; import dingshirenwu.ScheduledService; import dingshirenwu.TaskScheduleConfig; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import javax.servlet.http.HttpServletRequest; import java.util.List; @Controller public class UserController { @Autowired private UserService userService; @RequestMapping("findList") public String findList(HttpServletRequest request){ ScheduledService s=new ScheduledService(); s.scheduled(); s.scheduled1(); s.scheduled2(); // AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(TaskScheduleConfig.class); List list= userService.findList(); System.out.println(list); request.setAttribute("list",list); return "list"; } @RequestMapping("findGoback") public String findGoback(HttpServletRequest request){ // AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(TaskScheduleConfig.class); List list= userService.findGoback(); System.out.println(list); request.setAttribute("list",list); return "list1"; } }
基本架构: