java - Spring - Boot Configuration -
i have spring boot app application.properties file, , spring data jpa. in app have external dependency , need load beans of external spring project has xml based config. external xml has own component scan , own spring jpa setup interact other db giving db properties in application.properties file, , using @importresources inject bean in parent app. when doing spring data jpa not loading interface repository beans.
problem loads bean of xml, fils load bean of repository bean of parent project.
appconfig.class
@configuration @componentscan(basepackages = {"com.xx.xx"}) public class appconfig { }
configproperties.class
@configuration @import({appconfig.class}) @importresource("classpath:xx-context.xml") public class configproperties { }
xx-context.xml (sample)
<mvc:annotation-driven /> <import resource="yy-repository.xml" /> <import resource="classpath:zz-config.xml" /> <context:component-scan base-package="com.yy.yy" /> <bean id="bean_id" //defination </bean> <bean> //defination </bean> </beans>
mainapp.java
@springbootapplication public class mainapp extends springbootservletinitializer {
exception
application failed start
description:
field aarepo in com.xx.xx.services.impl.yyimpl required bean of type 'com.xx.x.repository.aarepo' not found.
action
consider defining bean of type 'com.xx.xx.repository.aarepo' in configuration.`
use @enableautoconfiguration
on top of appconfigclass
Comments
Post a Comment