Java 为什么SpringCloudConfigServer在本地文件系统中生成gitHUb repo的副本
我有一个新的spring cloud配置服务器的spring启动项目,但当我从postman发出请求时,它正在生成远程git存储库的本地副本,甚至在响应中也显示了本地文件系统路径文件:C:\Users\admin\AppData\local\Temp\config-repo-6081787440422098267\application.propertiesJava 为什么SpringCloudConfigServer在本地文件系统中生成gitHUb repo的副本,java,spring,spring-boot,Java,Spring,Spring Boot,我有一个新的spring cloud配置服务器的spring启动项目,但当我从postman发出请求时,它正在生成远程git存储库的本地副本,甚至在响应中也显示了本地文件系统路径文件:C:\Users\admin\AppData\local\Temp\config-repo-6081787440422098267\application.properties package com.appsdeveloperblog.photoapp.api; import org.springframewo
package com.appsdeveloperblog.photoapp.api;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer;
@SpringBootApplication
@EnableConfigServer
public class PhotoAppApiConfigServerApplication {
public static void main(String[] args) {
SpringApplication.run(PhotoAppApiConfigServerApplication.class, args);
}
}
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.4.5)
2021-05-26 15:58:04.328 INFO 18252 --- [ main] a.p.a.PhotoAppApiConfigServerApplication : No active profile set, falling back to default profiles: default
2021-05-26 15:58:05.538 INFO 18252 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=100ad0d7-0a9d-3efe-a227-c536070252c7
2021-05-26 15:58:05.908 INFO 18252 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8012 (http)
2021-05-26 15:58:05.919 INFO 18252 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-05-26 15:58:05.919 INFO 18252 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.45]
2021-05-26 15:58:06.117 INFO 18252 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-05-26 15:58:06.117 INFO 18252 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1769 ms
2021-05-26 15:58:06.531 INFO 18252 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2021-05-26 15:58:09.145 INFO 18252 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator'
2021-05-26 15:58:09.295 INFO 18252 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8012 (http) with context path ''
2021-05-26 15:58:09.912 INFO 18252 --- [ main] a.p.a.PhotoAppApiConfigServerApplication : Started PhotoAppApiConfigServerApplication in 8.2 seconds (JVM running for 9.456)
2021-05-26 15:58:29.687 INFO 18252 --- [nio-8012-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-05-26 15:58:29.687 INFO 18252 --- [nio-8012-exec-2] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2021-05-26 15:58:29.690 INFO 18252 --- [nio-8012-exec-2] o.s.web.servlet.DispatcherServlet : Completed initialization in 3 ms
2021-05-26 15:58:35.886 INFO 18252 --- [nio-8012-exec-2] o.s.c.c.s.e.NativeEnvironmentRepository :
Adding property source: Config resource 'file [C:\Users\admin\AppData\Local\Temp\config-repo-6081787440422098267\application.properties]' via location 'file:/C:/Users/admin/AppData/Local/Temp/config-repo-6081787440422098267/'
配置
spring.application.name=PhotoAppAPIConfigServer
server.port=8012
spring.cloud.config.server.git.uri=https://github.com/balanjaneyulu23/PhotoAppCon
spring.cloud.config.server.git.username=xxxx
spring.cloud.config.server.git.password=xxxxxx
spring.cloud.config.server.git.clone-on-start=true
spring.cloud.config.server.git.default-label=master
控制台日志
package com.appsdeveloperblog.photoapp.api;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer;
@SpringBootApplication
@EnableConfigServer
public class PhotoAppApiConfigServerApplication {
public static void main(String[] args) {
SpringApplication.run(PhotoAppApiConfigServerApplication.class, args);
}
}
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.4.5)
2021-05-26 15:58:04.328 INFO 18252 --- [ main] a.p.a.PhotoAppApiConfigServerApplication : No active profile set, falling back to default profiles: default
2021-05-26 15:58:05.538 INFO 18252 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=100ad0d7-0a9d-3efe-a227-c536070252c7
2021-05-26 15:58:05.908 INFO 18252 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8012 (http)
2021-05-26 15:58:05.919 INFO 18252 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-05-26 15:58:05.919 INFO 18252 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.45]
2021-05-26 15:58:06.117 INFO 18252 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-05-26 15:58:06.117 INFO 18252 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1769 ms
2021-05-26 15:58:06.531 INFO 18252 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2021-05-26 15:58:09.145 INFO 18252 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator'
2021-05-26 15:58:09.295 INFO 18252 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8012 (http) with context path ''
2021-05-26 15:58:09.912 INFO 18252 --- [ main] a.p.a.PhotoAppApiConfigServerApplication : Started PhotoAppApiConfigServerApplication in 8.2 seconds (JVM running for 9.456)
2021-05-26 15:58:29.687 INFO 18252 --- [nio-8012-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-05-26 15:58:29.687 INFO 18252 --- [nio-8012-exec-2] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2021-05-26 15:58:29.690 INFO 18252 --- [nio-8012-exec-2] o.s.web.servlet.DispatcherServlet : Completed initialization in 3 ms
2021-05-26 15:58:35.886 INFO 18252 --- [nio-8012-exec-2] o.s.c.c.s.e.NativeEnvironmentRepository :
Adding property source: Config resource 'file [C:\Users\admin\AppData\Local\Temp\config-repo-6081787440422098267\application.properties]' via location 'file:/C:/Users/admin/AppData/Local/Temp/config-repo-6081787440422098267/'
邮差回复
{
"name": "PhotoAppAPIConfigServer",
"profiles": [
"default"
],
"label": null,
"version": "acbf41825d98ddabd5c8bf8eb066a33d584d6fba",
"state": null,
"propertySources": [
{
"name": "https://github.com/balanjaneyulu23/PhotoAppConfiguration/file:C:\\Users\\admin\\AppData\\Local\\Temp\\config-repo-6081787440422098267\\application.properties",
"source": {
"gateway.ip": "192.168.55.107",
"token.expiration_time": "864000",
"token.secret": "hfgry463hf746hf573ydh475fhy5739",
"login.url.path": "/users/login"
}
}
]
}
POM.XML
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.appsdeveloperblog.photoapp.api</groupId>
<artifactId>PhotoAppAPIConfigServer</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>PhotoAppAPIConfigServer</name>
<description>Config Server</description>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>2020.0.2</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-bootstrap -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
4.0.0
org.springframework.boot
spring启动程序父级
2.4.5
com.appsdeveloperblog.photoapp.api
PhotoAppAPIConfigServer
0.0.1-快照
PhotoAppAPIConfigServer
配置服务器
1.8
2020.0.2
org.springframework.cloud
spring云配置服务器
org.springframework.boot
弹簧起动试验
测试
org.springframework.cloud
SpringCloudStarter引导程序
org.springframework.cloud
spring云依赖关系
${spring cloud.version}
聚甲醛
进口
org.springframework.boot
springbootmaven插件
可能是它的原因spring.cloud.config.server.git.clone on start=true
?我在属性文件中注释掉了spring.cloud.config.server.git.clone on start=true这一行,但仍然存在相同的问题。是否尝试将其设置为false
spring.cloud.config.server.git.clone on start=false
是的,我做了,但没有任何效果