![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Spring Boot
文章平均质量分 62
John是橘红
...
展开
-
Freemarker异常:freemarker.template.TemplateNotFoundException: Template not found for name “xxx.ftl“.
问题背景在Spring Boot项目里整合Freemarker,目标是使用Freemarker模板文件生成代码。模板在在resources/template里边明明有对应的xxx.xml.ftl文件,但是却报错说没有找到该文件。freemarker.template.TemplateNotFoundException: Template not found for name "xxx.ftl"........产生问题原因此时便要注意Maven生成的项目了。在target文件夹,即编译成功的文件原创 2021-08-05 21:44:50 · 15284 阅读 · 2 评论 -
使用注解注册Bean的四种方法
刚开始学的时候,都是在xml里面注册类,或者直接在类上面写@Bean相关的注解。但是理解这些还不够,因为这些注册组件的效率并不高,此外,SpringBoot的源码往往并不是用上面的方法注册的,理解下面的注册方法有利于理解springboot。@Import是关键的注解,可以直接引入类、配置类、注册类等。以下的组件注册和@Import有很大的关系。在进行下面的练习前,需要自行添加一些实体类。1. @Import直接引入需要组装的类@Import指定要注入Apple和Banana实体类@EnableFr原创 2021-08-01 16:06:15 · 1403 阅读 · 0 评论 -
@SpringBootApplication 里的三大注解作用
@SpringBootApplication是启动SpringBoot项目的关键注解。点击进入注解源码,可以看到关键的三行注解:@SpringBootConfiguration,@EnableAutoConfiguration和@ComponentScan@SpringBootConfiguration@EnableAutoConfiguration@ComponentScan(excludeFilters = { @Filter(type = FilterType.CUSTOM, classes =原创 2021-08-01 15:26:25 · 1101 阅读 · 0 评论