应用程序中的Spring,yaml看不到我的库的类路径

brqmpdu1  于 2022-12-17  发布在  Spring
关注(0)|答案(1)|浏览(155)

我尝试从lib使用conf文件,但applcation.yaml看不到lib类路径
这是我的gradle.build
image of apllication.yaml

plugins { 
  id 'java' 
  id 'org.springframework.boot' version '2.7.6' 
  id 'io.spring.dependency-management' version '1.1.0' 
}

group = 'common' 
version = '0.0.1-SNAPSHOT' 
sourceCompatibility = '8'

configurations { 
  compileOnly { 
    extendsFrom annotationProcessor 
  } 
}

repositories { 
  mavenCentral() 
  flatDir { 
    dirs 'libs' 
  } 
}

dependencies { 
  implementation 'org.springframework.boot:spring-boot-starter-jdbc' 
  implementation 'org.mockito:mockito-core:4.9.0'
  implementation 'org.springframework.boot:spring-boot-starter-web' 
  implementation 'org.springframework.boot:spring-boot-starter-data-jpa' 
  implementation group: 'ma.glasnost.orika', name: 'orika-core', version: '1.5.4' 
  implementation 'common:0.3.2' 
  implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.6.13' 
  implementation group: 'com.oracle.database.jdbc', name: 'ojdbc8', version: '21.7.0.0' 
  implementation 'org.postgresql:postgresql' 
  implementation 'org.jetbrains:annotations:23.0.0' 
  implementation 'org.springframework.boot:spring-boot-starter-cache:2.7.6' 
  implementation 'org.springframework.boot:spring-boot-starter-data-redis:2.7.6' 
  compileOnly 'org.projectlombok:lombok' 
  annotationProcessor 'org.projectlombok:lombok' 
  testImplementation 'org.springframework.boot:spring-boot-starter-test' 
}

tasks.named('test') { 
  useJUnitPlatform() 
}

有人能解释一下我做错了什么吗?

2izufjch

2izufjch1#

库目录中的所有内容都需要放到src/main/resources中,然后才能在类路径中看到。

相关问题