목록개발/Spring (7)
웁스교교주의 이야기
http .sessionManagement() .sessionCreationPolicy( SessionCreationPolicy.정책상수) SessionCreationPolicy.ALWAYS - 스프링시큐리티가 항상 세션을 생성 SessionCreationPolicy.IF_REQUIRED - 스프링시큐리티가 필요시 생성(기본) SessionCreationPolicy.NEVER - 스프링시큐리티가 생성하지않지만, 기존에 존재하면 사용 SessionCreationPolicy.STATELESS - 스프링시큐리티가 생성하지도않고 기존것을 사용하지도 않음(jwt와 같은 토큰방식을 쓸 때 사용한다.)
java -jar -Dspring.profiles.active=dev demo-0.0.1-SNAPSHOT.jar 이런식으로 profile을면 된다.
spring boot에서 security 에서 WebSecurityConfigurerAdapter 설정시 Error creating bean with name 'defaultServletHandlerMapping' defined in class path resource 에러가 발생한다. 왜 필터체인을 못 찾는지 정확한 이유는 아직 못 찾았다. 일단 대신 GlobalMethodSecurityConfiguration 에 WebSecurityConfigurerAdapter의 설정을 해주면 이상없이 작동한다. WebSecurityConfigurerAdapter와 GlobalMethodSecurityConfiguration 관계를 좀 알아봐야겠다.
spring boot 1.4.2부터 아마 characterEncodingFilter->OrderedCharacterEncodingFilter 변경된것 같다. @Bean public OrderedCharacterEncodingFilter characterEncodingFilter() { OrderedCharacterEncodingFilter filter = new OrderedCharacterEncodingFilter(); filter.setEncoding("UTF-8"); filter.setForceEncoding(true); filter.setOrder(Ordered.HIGHEST_PRECEDENCE); return filter; } 요렇게 변경하면 됩니다. 주의 Ordered.HIGHEST_PRECE..
Spring boot에서 @RequestBody 사용시 application/x-www-form-urlencoded 으로 Content type 을 보내면 "status": 415, "error": "Unsupported Media Type", "exception": "org.springframework.web.HttpMediaTypeNotSupportedException", "message": "Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported", 의 에러가 발생합니다. 검색을하면 지원을 안하는 것으로 나오는데... 맞는지 모르네요. 일단 Content type을 application/json으로 하면 제대로 작동합..
spring boot를 intellij에서 개발 중인데 bootrun시 profile 설정이 제대로 안되는 문제에 봉착!! 검색 결과 grade 파일에 bootRun { args = ["--spring.profiles.active=dev"] } 추가 해주면 해결된다.
#어플리케이션 설정http.port=80 server.port=443 server.ssl.key-store=/home/account/keystore server.ssl.key-store-password=keystore server.ssl.key-password=privatekey //톰캣 컨테이너 설정 @Configuration public class TomcatConfig { @Value("${http.port}") private int httpPort; @Bean public EmbeddedServletContainerCustomizer containerCustomizer() { return new EmbeddedServletContainerCustomizer() { @Override public v..