spring-boot 5

스프링 부트에서의 context-param 설정 방법

스프링 부트에서의 context-param 설정 방법 기존의 web.xml 타입 설정에서는 다음과 같이 컨텍스트파라미터를 설정할 수 있습니다. web.xml ... p-name -value ... 스프링 부트에서 이 작업은 어떻게 수행됩니까?매개 변수가 필요한 필터가 있습니다. 사용하고 있다@EnableAutoConfiguration를 포함하다spring-boot-starter-jetty내 폼에. 파라미터를 설정하려면server.servlet.context-parameters응용 프로그램 속성.예를 들어 다음과 같습니다. server.servlet.context-parameters.p-name=p-value 더 이상 지원되지 않는 Spring Boot 1.x에서는 이 속성의 이름이 지정되었습니다.serv..

programing 2023.04.05

로그에 WARN 메시지를 기록하지 않는 Spring @ExceptionHandler 메서드를 작성하려면 어떻게 해야 합니까?

로그에 WARN 메시지를 기록하지 않는 Spring @ExceptionHandler 메서드를 작성하려면 어떻게 해야 합니까? Spring Boot 어플리케이션을 사용하고 있습니다.@ExceptionHandler내가 원하는 걸 대부분 해.HTTP 상태 코드를 409로 설정하고 추가 오류 정보를 JSON 응답에 포함합니다. @ExceptionHandler(PolicyExecutionException.class) public ResponseEntity handleException(PolicyExecutionException se){ return ResponseEntity.status(HttpStatus.CONFLICT).body(se.getScriptErrorMap()); } 내가 깨달은 것은 스프링이 클라이..

programing 2023.03.31

여러 데이터 소스를 구성한 후 JPA 명명 전략을 설정할 수 없음 (Spring 1.4.1 / Hibernate 5.x)

여러 데이터 소스를 구성한 후 JPA 명명 전략을 설정할 수 없음 (Spring 1.4.1 / Hibernate 5.x) 휴지 상태 5.0.11을 사용하는 Spring Boot 1.4.1을 사용하고 있습니다.처음에는 다음을 사용하여 데이터 소스를 구성했습니다.application.properties다음과 같습니다. spring.datasource.uncle.url=jdbc:jtds:sqlserver://hostname:port/db spring.datasource.uncle.username=user spring.datasource.uncle.password=password spring.datasource.uncle.dialect=org.hibernate.dialect.SQLServer2012Dialect..

programing 2023.03.31

스프링은 @Autowired Annotation 없이 생성자에 종속성을 주입합니다.

스프링은 @Autowired Annotation 없이 생성자에 종속성을 주입합니다. 이 Spring 공식 튜토리얼의 예를 시험하고 있는데, 이 코드에 의존합니다. https://github.com/spring-guides/gs-async-method/tree/master/completehttpsgithub.com/spring-guides//tree/master/complete 「 」의 , 「 」의 코드를 해 주세요.AppRunner.java두 가지 질문이 : ㅇㅇㅇ, ㅇㅇㅇㅇ, ㅇㅇㅇㅇ. 때이를 넣으면 .GitHubLookupService봄을 하여 제공되고 있습니다.@Service그런 게 없었어요.@Autowired어떻게 이 컨스트럭터를 올바른 의존관계로 호출할 수 있을까요?원래 이렇게 하기로 되어있었는..

programing 2023.03.21

Spring Security anonymous 403 대신 401

Spring Security anonymous 403 대신 401 Java Config에서 제공되는 권한 요청과 함께 스프링 보안의 기본 동작에 문제가 있습니다. http .... .authorizeRequests() .antMatchers("/api/test/secured/*").authenticated() 예를 들어 에 콜을 할 때/api/test/secured/user로그인하지 않은 경우(익명의 사용자가 있는 경우), 403 Forbidden을 반환합니다.익명의 사용자가 보안 보호를 원할 때 상태를 401 Unauthorized로 쉽게 변경할 수 있는 방법이 있습니까?authenticated()또는@PreAuthorize자원?Spring Boot 2 클래스 Http401 현재Authenticatio..

programing 2023.03.16