2021-03-07

https://blog.csdn.net/weixin_37056888/article/details/108953093

配置的优先级
file:./config/
file:./
classpath:./config/
classpath:./

引入oss starter
配置keystarter相关信息
使用ossclient

整合OSS依赖导入后启动报错

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    com.alibaba.cloud.context.AliCloudSdk.<init>(AliCloudSdk.java:76)

The following method did not exist:

    'com.aliyuncs.http.HttpClientConfig com.aliyuncs.profile.DefaultProfile.getHttpClientConfig()'

The method's class, com.aliyuncs.profile.DefaultProfile, is available from the following locations:

    jar:file:/C:/Users/3333/.m2/repository/com/aliyun/aliyun-java-sdk-core/3.4.0/aliyun-java-sdk-core-3.4.0.jar!/com/aliyuncs/profile/DefaultProfile.class

The class hierarchy was loaded from the following locations:

    com.aliyuncs.profile.DefaultProfile: file:/C:/Users/3333/.m2/repository/com/aliyun/aliyun-java-sdk-core/3.4.0/aliyun-java-sdk-core-3.4.0.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of com.aliyuncs.profile.DefaultProfile


Process finished with exit code 1

解决

	<!--阿里云oss-->
    <dependency>
        <groupId>com.alibaba.cloud</groupId>
        <artifactId>aliyun-oss-spring-boot-starter</artifactId>
        <version>1.0.0</version>
    </dependency>
    <!--导入新的依赖-->
	<dependency>
        <groupId>com.aliyun</groupId>
        <artifactId>aliyun-java-sdk-core</artifactId>
        <version>4.4.5</version>
    </dependency>

https://blog.csdn.net/qq_42569573/article/details/113093682

maven项目pom.xml文件第一行报错解决方法

今天在新建一个maven项目时,第一行报了一个错,内容如下

Project build error: Non-parseable POM D:\sts\repository\org\springframework\cloud\spring-cloud-contract-dependencies\1.1.5.RELEASE\spring-cloud-contract-dependencies-1.1.5.RELEASE.pom: processing instruction can not have PITarget with reserved xml name

导致问题原因:因为网络原因导致jar没有下好。

解决方法:找到你本地下载存放jar的地方,然后删除对应的错误jar,我这里删除的就是pring-cloud-contract-dependencies,然后在项目中重新update maven下就好了。

原文链接:https://blog.csdn.net/huxiaodong1994/article/details/82784350

<dependency>
                <groupId>com.alibaba.cloud</groupId>
                <artifactId>spring-cloud-alibaba-dependencies</artifactId>
                <version>2.1.0.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

要加在dependencymanagemant里面

一般404都是由于路径问题引起的

导的包+crtl可以看到源码

JSR303存在问题 postman

JSR303
给bean添加校验注解:javax.validation.constraints,并定义自己的message提示

开启校验功能@Valid
效果:校验错误以后会有默认的响应

给校验的bean后紧跟一个BindingResult ,就可以获取到校验结果

分组校验(多场景的复杂校验)
@NotBlank(message= “品牌名必须提交”,groups = {AddGroup.class,UpdateGroup.class})
给校验注解标注什么情况需要校验
@Validated({AddGroup.class})
默认没有指定分组的校验注解@NotBlank,在分组校验情况下不生效@Validated({AddGroup.class})下生效

自定义的校验
编写自定义的校验注解
编写自定义的校验器
关联自定义的校验器和校验注解

统一的异常处理
@ControllorAdvice
编写异常处理类使用@ControllorAdivce
使用@ExceptionHandler标注方法可以处理所有异常

Maven工程 报 Diamond types are not supported at language level ‘5’

<build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

父子组件传送数据
子组件给父组件传送数据,事件机制
子组件给父组件传送一个事件,携带数据

上一篇:K8S中部署KAFKA集群


下一篇:### Teamviewer 手机端怎么拖动窗口,选中文字