不可能打工的友仔整合spring boot+shiro+freemarker的踩坑记

不可能打工的友仔整合spring boot+shiro+freemarker的踩坑记
1.spring boot整合jpa不自动建表

问题分析:主函数无法扫描到域类位置

解决方法:

@SpringBootApplication
@EntityScan //扫描entity
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class,args);
    }
}

2.配置shiro-freemarker-tags不加载类

问题分析:启动项目未加载类,应该也是没配置扫描

解决方法:主方法入口加上注解@ComponentScan

注意:主函数加上注解,并且你的诸如Service,dao,controller都要加上对应的注解,该注解会自动扫描:@Component, @Service, @Repository, @Controller等的注解类。


3.shiro配置未加载,还会报错

问题分析:配置未加载多半也是没扫描到,要么是shiro配置类未加注解,要么是主函数入口没加扫描注解

注意:本人在集成的时候,继承了父类,同时类上也加了@Confguration注解,结果启动报错,此时我查看被继承的父类,结果发现里面也有个注解,所以得注意,如果父类有注解的时候要么去掉当前注解,要么不继承,直接以当前类为准。


  • 发表于 2018-05-02 16:54
  • 阅读 ( 1839 )
  • 分类:springboot

0 条评论

请先 登录 后评论
不写代码的码农
Jonny

程序猿

65 篇文章

作家榜 »

  1. 威猛的小站长 124 文章
  2. Jonny 65 文章
  3. 江南烟雨 36 文章
  4. - Nightmare 33 文章
  5. doublechina 31 文章
  6. HJ社区-肖峰 29 文章
  7. 伪摄影 22 文章
  8. Alan 14 文章