- import org.springframework.boot.SpringApplication;
- import org.springframework.boot.autoconfigure.SpringBootApplication;
- import org.springframework.context.annotation.ImportResource;
- import org.springframework.transaction.annotation.EnableTransactionManagement;
- /**
- * @SpringBootApplication
- * 自动增加spring.xml文件,并且配置自动扫描
- * 自动增加web.xml 同时在web.xml过滤器、拦截器...
- *
- * @EnableAutoConfiguration要替换成@SpringBootApplication
- * 不然扫描不到dao层,装配不了EmpDaoImpl
- * 要装配的对象必须位于HelloController类共一个包或它的子包下才可以扫描的到
- *
- *
- * @ImportResource(locations="classpath:/spring.xml")
- * 加载spring的配置文件,会自动加载spring里所有的bean
- * 也会自动配置
- */
- @ImportResource(locations="classpath:/spring.xml")
- @SpringBootApplication
- public class MyStarter {
- public static void main(String[] args) {
- //发布程序的方法入口
- SpringApplication.run(MyStarter.class, args);
- }
- }
Spring Boot集成My Batis之加载spring.xml文件
最新推荐文章于 2022-11-09 20:03:16 发布