boot

vue打包整合到spring boot一记

匿名 (未验证) 提交于 2019-12-02 23:36:01
背景 vue-cli打包之前的配置 总结 背景 前段时间,根据需求,要将项目烧入到芯片,但我的擅长之处就是前后端分离开发,因此需要前端vue开发好,打包放到后端里面一起执行。那时候碰到好多貌似不可逾越的坑,今天终于可以抽出点时间,记录一下过程笔记。 vue-cli打包之前的配置 脚手架创建会生成如下的目录: 首先我们先把vue路由里的#去掉 只需在router里面加如下代码: 配置build文件夹下的index.js build: { // Template for index.html index: path.resolve(__dirname, '../../static/public/index.html'), // Paths assetsRoot: path.resolve(__dirname, '../../static/public'), assetsSubDirectory: 'static', assetsPublicPath: '/后端的context-path值/public/', /** * Source Maps */ productionSourceMap: false, // https://webpack.js.org/configuration/devtool/#production devtool: 'source-map', // Gzip

SpringBoot框架(2)--配置文件

匿名 (未验证) 提交于 2019-12-02 23:34:01
1、添加新项目,选择Spring Initializr方式创建项目 2、默认配置读取顺序 -- /config/路径下优先,properties 比 yml 优先 注意:默认读取的配置文件必须命名为:application,否者读取不到 2.1 通过Environment方式读取 /resources/application.properties文件 1 local.ip.addr=192.168.3.110-pro 1 package com.demo.boot.bootconfig; 2 3 import org.springframework.boot.SpringApplication; 4 import org.springframework.boot.autoconfigure.SpringBootApplication; 5 import org.springframework.context.ConfigurableApplicationContext; 6 import org.springframework.core.env.Environment; 7 8 @SpringBootApplication 9 public class BootConfigApplication { 10 11 public static void main(String[]

Spring Boot : @EnableConfigurationProperties -- 注册使用 @ConfigurationProperties 的bean

匿名 (未验证) 提交于 2019-12-02 23:34:01
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/andy_zhang2007/article/details/90286737 @EnableConfigurationProperties 是 Spring Boot 提供的一个注解,使用该注解用于启用应用对另外一个注解 @ConfigurationProperties 的支持。使用注解 @ConfigurationProperties 的 bean 可以通过标准方式注册到容器,比如使用注解 @Bean ;也可以使用该注解注册到容器,如下用法所示 : @EnableConfigurationProperties ( SecurityProperties . class ) //... public class SecurityAutoConfiguration { // ... } EnableConfigurationProperties 只定义了一个 value 属性,用于设置一组使用了注解 @ConfigurationProperties 的类,用于作为 bean 定义注册到容器中。 EnableConfigurationProperties 完成配置属性 bean 注册的具体任务是委托给了所导入的类

spring boot整合模版引擎thymeleaf

匿名 (未验证) 提交于 2019-12-02 23:32:01
动态资源:spring boot 默认不支持jsp。 spring boot推荐使用thymeleaf 网页=模版+数据 引入thymeleaf: https://docs.spring.io/spring-boot/docs/2.1.4.RELEASE/reference/htmlsingle/#using-boot-starter thymeleaf官网: https://www.thymeleaf.org/ thymeleaf 3.0的文档: https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.pdf 找到spring-boot-starter-thymeleaf 点击后面的pom,将依赖拷贝到项目的pom.xml中 <dependency> <groupId> org.springframework.boot </groupId> <artifactId> spring-boot-starter </artifactId> </dependency> <dependency> <groupId> org.thymeleaf </groupId> <artifactId> thymeleaf-spring5 </artifactId> </dependency> <dependency> <groupId>

spring boot 项目错误,错误Execution default-resources of goal org.apache.maven.plugins

匿名 (未验证) 提交于 2019-12-02 23:30:02
sts导入springboot项目。 这时候产生了一个错误。 Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:3.1.0:resources failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-resources-plugin:3.1.0:resources: java.lang.LinkageError: loader constraint violation: when resolving interface method "org.sonatype.plexus.build.incremental.BuildContext.newScanner(Ljava/io/File;Z)Lorg/codehaus/plexus/util/Scanner;" the class loader (instance of org/codehaus/plexus/classworlds/realm/ClassRealm) of the current class, org/apache/maven/shared/filtering

SSM框架优缺点和spring boot 比起优缺点是什么?

匿名 (未验证) 提交于 2019-12-02 23:26:52
一、SSM优缺点应该分开来说的,比如 1) spring 不说了,核心ioc、aop技术,ioc解耦,使得代码复用,可维护性大幅度提升,aop提供切面编程,同样的增强了生产力。 2) spring mvc ,是对比struts2等mvc框架来说的,不说struts2爆出的那么多安全漏洞,而且是类拦截,所有Action变量共享,同时是filter入口的,而spring mvc是方法拦截,controller独享request response数据,采用的serlvet入口,与spring无缝对接。开发而言,spring mvc更加轻量和低入门。 3)mybatis嘛,看业务场景,主要是mybatis的sql可以由开发者去掌控和调优,相对hibernate等orm框架来说,更加直观。在业务场景比较复杂,sql好多联合关联的情况下,mybatis谁用谁知道。当然缺点就是对sql不熟悉的开发者就不太友好了。 二、 SSM框架和spring boot全家桶相比有哪些优缺点? 这两者对比起来有点奇怪。因为SSM是WEB应用框架,涵盖整个应用层,而spring boot你可以看做一个启动、配置、快速开发的辅助框架,本身针对的是微服务。 springboot 只是为了提高开发效率,是为了提升生产力的: 1、springboot一个应用是一个可执行jar(启动类main方法启动web应用)

Spring Boot PostConsruct

匿名 (未验证) 提交于 2019-12-02 23:26:52
先 autowired autowired 之后再执行 package com . example . demo ; import org . springframework . beans . factory . annotation . Autowired ; import org . springframework . boot . SpringApplication ; import org . springframework . boot . autoconfigure . SpringBootApplication ; import org . springframework . stereotype . Component ; import javax . annotation . PostConstruct ; @Component class A { void print ( ) { System . out . println ( "A" ) ; } } @Component class B { @Autowired A a ; @PostConstruct void init ( ) { a . print ( ) ; } } @SpringBootApplication public class DemoApplication { @Autowired B

Spring Boot Web项目解决ajax跨域

匿名 (未验证) 提交于 2019-12-02 23:26:52
【转】SpringBoot项目ajax 跨域post请求问题 在Application启动类中注册WebMvcConfigurer @Bean public WebMvcConfigurer webMvcConfigurer() { return new WebMvcConfigurerAdapter() { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**").allowedOrigins("*"); } }; } 文章来源: https://blog.csdn.net/Tdh5258/article/details/88842344