使用maven创建对象并用springboot、springcord创建对象

1。导入包

<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>

2在新建一个配置文件
package com.lol.kfz.scwproject.config;

import com.lol.kfz.scwproject.servers.OssTemplate;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AppProjectConfig {
@ConfigurationProperties(prefix="oss")
@Bean
public OssTemplate ossTemplate(){
return new OssTemplate();
}

3.在application.yml配置文件的重要的操作。
spring:
datasource:

driver-class-name: com.mysql.cj.jdbc.Driver
password: root
username: root
url: jdbc:mysql://127.0.0.1:3306/atcrowd?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
redis:
host: 127.0.0.1
# main:
# allow-bean-definition-overriding: true

mybatis:
config-location: classpath:/mybatis/mybatis-config.xml
mapper-locations: classpath:/mybatis/mapper/*Mapper.xml


eureka:
client:
service-url:
defaultZone: http://localhost:8762/eureka/
instance:
appname: scw-project
prefer-ip-address: true
server:
port: 8000


使用eureka管理方便,好测试
加油,程序员小龙