用户单击运行后发生的事
主类启动,maven配置文件定义主类。
<build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><configuration><excludes><exclude><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></exclude></excludes><mainClass>*****</mainClass></configuration></plugin></plugins><resources><resource><directory>src/main/java</directory><includes><include>**/*</include></includes><filtering>false</filtering></resource><resource><directory>src/main/resources</directory><includes><include>**/*</include></includes><filtering>false</filtering></resource></resources></build>
Controller监听接口
"menu") (publicclassMenuController { privateMenuServicemenuService; "/getMenu") (publicResponseEntity<List<T>>queryByRole(Objectargs) { List<T>res=this.menuService.queryById(args); returnResponseEntity.ok(res); } }
Service调用服务
publicinterfaceMenuService { List<Menu>queryById(Stringrouter); }
Service实现服务
"menuService") (publicclassMenuServiceImplimplementsMenuService { privateMenuDaomenuDao; publicList<Menu>queryById(Objectargs) { returnthis.menuDao.queryById(args); } }
DAO操作数据库
publicinterfaceMenuDao { List<Menu>queryById(Objectargs); }