在学习 springboot 框架时遇到这个问题,首先整合了 springboot 与 mybatis,没有用模板框架,controller 直接返回数据,运行之后服务启动正常,浏览器访问正常,数据显示正常! 然后开始整合模板 thymeleaf 时出现问题了,我先是配置 application.yml 中的 thymeleaf 的相关配置,和 thymeleaf 的 pom 文件依赖,配置信息和依赖如下: #模板类配置 spring: freemarker: cache: false prefix: classpath:/templates/ suffix: .html encoding: UTF-8 content-type: text/html mode: HTML5 <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-thymeleaf</artifactid> </dependency> 然后写好 controller 和模板类,开始运行项目,出现各种异常,详情如下: Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no embedded datasource could be auto-configured.报出这个异常后,我在启动类注解上加上这个:@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})然后再重新启动,上面这个问题不报了,出现了个新的问题,详情如下:java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required,求解决方案,不胜感激!
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.