Spring Boot 버전을 2.0.3에서 변경할 때 문제가 발생합니다.릴리스 2.1.0.빌드 스냅샷
Spring Boot 버전 변경 시 동작을 정지하는 작업 코드가 있습니다.2.0.3.RELEASE
로.2.1.0.BUILD-SNAPSHOT
.
다음과 같은 오류가 발생할 수 있습니다.
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
***************************
APPLICATION FAILED TO START
***************************
Description:
The bean 'dataSource', defined in BeanDefinition defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class] and overriding is disabled.
Action:
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
또는...
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-07-16 14:38:18.509 ERROR 604 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
The bean 'scopedTarget.oauth2ClientContext', defined in class path resource [org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2RestOperationsConfiguration$SessionScopedConfiguration$ClientContextConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/security/oauth2/config/annotation/web/configuration/OAuth2ClientConfiguration$OAuth2ClientContextConfiguration.class] and overriding is disabled.
Action:
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
두 경우 모두 다른 복제 콩과 관련이 있습니다.
POM 의존관계는 다음과 같습니다.
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.3.RELEASE</version>
<relativePath/>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Finchley.BUILD-SNAPSHOT</spring-cloud.version>
<maven.test.skip>true</maven.test.skip>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-oauth2</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
및 설정:
server:
error:
include-stacktrace: always
whitelabel:
enabled: false
servlet:
session:
cookie:
name: HYDRASSESSION
port: 36205
management:
endpoints:
web:
exposure:
include: "*"
security:
basic:
enabled: false
oauth2:
client:
clientId: atlas
clientSecret: secret
accessTokenUri: http://myserverip:36202/oauth/token
userAuthorizationUri: http://myserverip:36202/oauth/authorize
resource:
userInfoUri: http://myserverip:36202/user/me
spring:
jpa:
properties:
hibernate:
temp:
use_jdbc_metadata_defaults: false
hibernate:
ddl-auto: validate
application:
name: atlas
datasource:
password: admin
username: postgres
url: jdbc:postgresql://myserverip:36211/atlas?ApplicationName=Atlas
guardiao:
logout:
path: http://myserverip:36202/exit
사용시 정상적으로 동작합니다.2.0.3.RELEASE
로그인을 시도하면 오류가 발생합니다.myserver:36202/oauth/authorize?client_id=
: 브라우저에 의한 불만ERR_TOO_MANY_REDIRECTS
콘솔에는 오류가 없습니다.아무튼...Spring Boot을 2.1.0으로 업데이트하려면 어떻게 해야 합니까?BUILD-SNAPSHOT?
따라서 예외에서 보고한 바와 같이 같은 유형의 콩이 2개 있습니다.역사적으로 봄은 한 콩을 다른 콩으로 대체했다.전혀 다른 타입의 두 번째 콩이 같은 아이디를 가지고 있으면 첫 번째 콩이 사라지는 벌레를 찾기 힘들기 때문에 그것은 오랫동안 성가신 일이었다.
Spring Boot 2는 이러한 종류의 빈 오버라이드를 디폴트로 디세블로 합니다.application.yml에서 다음 속성을 설정하여 다시 활성화할 수 있습니다.
spring.main.allow-bean-definition-overriding: true
이것에 의해, 이전의 동작이 재차 유효하게 됩니다.그러나 콩이 오버라이드되는 근본 원인은 다루지 않으며 콩 오버라이드 오류의 이점을 얻을 수 없습니다.기본 라이브러리를 업그레이드하면 시간이 지남에 따라 이 문제가 해결됩니다.
다른 코멘트에 기재되어 있듯이spring-security-oauth2-autoconfigure
에 대한 의존.org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:2.1.0.RELEASE
해결할 수 있을 거예요
이 답변은 새로운 프로젝트를 셋업하고 새로운 프로젝트를 추가한 사용자에게 도움이 될 수 있습니다.spring.main.allow-bean-definition-overriding: true
에 있어서의 재산.application.properties
파일이 문제를 수정하지 않습니다.
다음 폴더를 확인합니다.application.properties
파일이 있음 - 다음 디렉토리에서 직접 사용할 수 있어야 합니다.src/main/resources/
다른 곳도 아니고
언급URL : https://stackoverflow.com/questions/51367566/trouble-when-changing-spring-boot-version-from-2-0-3-release-to-2-1-0-build-snap
'programing' 카테고리의 다른 글
PHP 팩터 30 Linux와 Windows의 성능 차이 (0) | 2023.03.29 |
---|---|
리액트 훅: 사용 중인 첫 번째 실행 건너뛰기 효과 (0) | 2023.03.29 |
MongoDb 합계 쿼리 (0) | 2023.03.29 |
TypeScript에서 Enum like type을 생성하는 방법 (0) | 2023.03.29 |
잭슨과의 JSON 역직렬화 커스텀 (0) | 2023.03.29 |