Spring Boot包位置设置

Laughing
2019-07-21 / 0 评论 / 1,158 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2024年03月18日,已超过305天没有更新,若内容或图片失效,请留言反馈。
/* 
 *     Copyright (C) 2019  木子网https://www.xiangcaowuyu.net 
 *     项目名称:Net.XiangCaoWuYu.Idea 
 *     文件名称:App.java 
 *     Date:19-7-19 上午1:21 
 *     Author:lisen@lisen.org 
 *     This program is free software: you can redistribute it and/or modify 
 *     it under the terms of the GNU General Public License as published by 
 *     the Free Software Foundation, either version 3 of the License, or 
 *     (at your option) any later version. 
 * 
 *     This program is distributed in the hope that it will be useful, 
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of 
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 *     GNU General Public License for more details. 
 * 
 *     You should have received a copy of the GNU General Public License 
 *     along with this program.  If not, see <https://www.gnu.org/licenses/>. 
 */  
  
package Net.XiangCaoWuYu;  
  
import org.springframework.boot.SpringApplication;  
import org.springframework.boot.autoconfigure.SpringBootApplication;  
import org.springframework.boot.orm.jpa.EntityScan;  
import org.springframework.context.annotation.ComponentScan;  
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;  
  
@SpringBootApplication  
//SpringBoot 默认从App类往下面的包扫描  
//所以如果控制器、实体等类与App不在一个包,同时不在下面的包时,必须手动指定包  
//@ComponentScan(basePackages = {"Net.XiangCaoWuYu.Controllers", "Net.XiangCaoWuYu.Services"})  
//@EnableJpaRepositories(basePackages = {"Net.XiangCaoWuYu.Repositories", "Net.XiangCaoWuYu.Services"})  
//@EntityScan(basePackages = {"Net/XiangCaoWuYu/Pojos"})  
  
public class App {  
    public static  void main(String[] args){  
        SpringApplication.run(App.class,args);  
    }  
} 
0

评论 (0)

取消
  1. 头像
    eric
    Android · Google Chrome

    画图

    回复
  2. 头像
    啦啦啦
    MacOS · Safari

    回复