开始,加了这个注解,一定不要加这段代码 这个注解是排除自动注入 导致mapper注入不进去。
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'areaDicMapper' defined in file [/home/tongning/ideaprojects/foooooot/dao/target/classes/com/travel/dao/areadic/AreaDicMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required
原来是没有在application.properties中加spring.datasource的属性报下面的错。
但是奇怪的是我另外一个模块没有加,不会报错。(用的是Bean注入的c3p0)。那么我用了内置的,c3p0就失效了。等找到解决办法再编辑吧。
If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).