1. 程式人生 > 其它 >雙劍合璧:springboot打包將vue引入

雙劍合璧:springboot打包將vue引入

技術標籤:shirovuespringboot vuespringboot打包打包

1.在resources資料夾下新建static資料夾,然後vue打包為dist資料夾,將dist內的內容拷貝到static資料夾下
在這裡插入圖片描述
2.我的攔截器用的是shiro,所以在shiro的config裡做放行。

    @Bean
    public ShiroFilterFactoryBean shiroFilterFactoryBean(SecurityManager securityManager) {
        ShiroFilterFactoryBean shiroFilterFactoryBean =
new ShiroFilterFactoryBean(); shiroFilterFactoryBean.setSecurityManager(securityManager); Map<String, String> filterMap = new HashMap<String, String>(); // 登出 filterMap.put("/logout", "logout"); filterMap.put("/user/login"
, "anon"); filterMap.put("/", "anon"); filterMap.put("/static/img/**","anon"); filterMap.put("/static/css/**","anon"); filterMap.put("/static/fonts/**","anon"); filterMap.put("/static/js/**"
,"anon"); filterMap.put("/user/getOpenid", "anon"); // 對所有使用者認證 filterMap.put("/**", "authc"); // 登入 shiroFilterFactoryBean.setLoginUrl("/"); shiroFilterFactoryBean.setUnauthorizedUrl("/user/401"); shiroFilterFactoryBean.setFilterChainDefinitionMap(filterMap); return shiroFilterFactoryBean; }