spring子配置类不从子模块加载

时间:2018-03-05 22:34:59

标签: spring-boot

我有多个模块项目:

myapi : com.project.api
mypersistence : com.project.persistence
mymodel
myweb

api模块将mypersistence作为依赖项。 我正在谈论的配置类应该是从类路径中检测到的,但由于我忽略或遗漏的原因不是这种情况

配置类PersistenceConfig位于持久性模块

中的com.project.persistence.config包下
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(basePackages = {"com.todaysspecial.persistence.repositories"})
@EntityScan(basePackages = {"com.todaysspecial.model"})
public class PersistenceConfig {
}

ApiApplication类位于com.project.api

请帮忙吗?

1 个答案:

答案 0 :(得分:0)

要解决此问题,我将所有内容都移到public class MajorListActivity extends AppCompatActivity { DatabaseReference db; FirebaseHelper firebasehelper; MajorListAdapter adapter; ListView lv_MajorList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_major_list); lv_MajorList = (ListView) findViewById(R.id.lv_MajorList); db= FirebaseDatabase.getInstance().getReference(); firebasehelper=new FirebaseHelper(db); //ADAPTER adapter = new MajorListAdapter(getApplicationContext(),firebasehelper.retrieveMajor()); lv_MajorList.setAdapter(adapter); } } 下 但我不相信,因为我想使用com.project