spring-boot

Configure Spring Security for multiple login pages in a Spring Boot application

旧巷老猫 提交于 2021-02-10 11:50:06
问题 @Configuration public class SpringSecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private AccessDeniedHandler accessDeniedHandler; @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable() .authorizeRequests() .antMatchers("/", "/home", "/about").permitAll() .antMatchers("/admin/**").hasAnyRole("ADMIN") .antMatchers("/user/**").hasAnyRole("USER") .anyRequest().authenticated() .and() .formLogin() .loginPage("/login") .permitAll() .and()

Cas no attributes come to client

限于喜欢 提交于 2021-02-10 09:35:31
问题 i am building SSO application with CAS. in spring client, no attributes came with CasAssertionAuthenticationToken . there are lots of samples on net, they seems to have no problem with this ( is something obvious missing?) for cas server, its all default configuration except i changed registered service default to make sure that is not the problem. this part look like this: <bean class="org.jasig.cas.services.RegexRegisteredService"> <property name="id" value="1"/> <property name="name" value

Cas no attributes come to client

蹲街弑〆低调 提交于 2021-02-10 09:34:46
问题 i am building SSO application with CAS. in spring client, no attributes came with CasAssertionAuthenticationToken . there are lots of samples on net, they seems to have no problem with this ( is something obvious missing?) for cas server, its all default configuration except i changed registered service default to make sure that is not the problem. this part look like this: <bean class="org.jasig.cas.services.RegexRegisteredService"> <property name="id" value="1"/> <property name="name" value

Cas no attributes come to client

≯℡__Kan透↙ 提交于 2021-02-10 09:34:25
问题 i am building SSO application with CAS. in spring client, no attributes came with CasAssertionAuthenticationToken . there are lots of samples on net, they seems to have no problem with this ( is something obvious missing?) for cas server, its all default configuration except i changed registered service default to make sure that is not the problem. this part look like this: <bean class="org.jasig.cas.services.RegexRegisteredService"> <property name="id" value="1"/> <property name="name" value

How to set placeholder values in properties file in spring

不问归期 提交于 2021-02-10 07:40:43
问题 Below is application.properties file app.not.found=app with {0} name can not be found. How to replace {0} with some value in spring? I am using below code to read properties file values. env.getProperty("app.not.found") but not getting how to set placeholder values. 回答1: Use MessageFormat.format(String pattern, Object ... arguments) . It accepts an array in second parameter, which will replace 0, 1 , 2 ... sequentially. MessageFormat.format(env.getProperty("app.not.found"), obj) obj will

Couldn't find type java.sql.Date. Are you missing a dependency on your classpath?

主宰稳场 提交于 2021-02-10 07:34:23
问题 I'm trying to run my application in Spring Boot using MongoDB with spring-data but I can't because IntelliJ shows me this error during build: Error:java: Couldn't find type java.sql.Date. Are you missing a dependency on your classpath? I'm using mongo java driver version 3.8.2, spring boot 2.1 and project is in Java 11. I have no idea what is wrong here could someone help me please? 回答1: Settings -> Build, Execution, Deployment -> Build Tools -> Maven/Gradle -> Runner -> tic on "Delegate IDE

Couldn't find type java.sql.Date. Are you missing a dependency on your classpath?

只愿长相守 提交于 2021-02-10 07:33:57
问题 I'm trying to run my application in Spring Boot using MongoDB with spring-data but I can't because IntelliJ shows me this error during build: Error:java: Couldn't find type java.sql.Date. Are you missing a dependency on your classpath? I'm using mongo java driver version 3.8.2, spring boot 2.1 and project is in Java 11. I have no idea what is wrong here could someone help me please? 回答1: Settings -> Build, Execution, Deployment -> Build Tools -> Maven/Gradle -> Runner -> tic on "Delegate IDE

Couldn't find type java.sql.Date. Are you missing a dependency on your classpath?

送分小仙女□ 提交于 2021-02-10 07:33:48
问题 I'm trying to run my application in Spring Boot using MongoDB with spring-data but I can't because IntelliJ shows me this error during build: Error:java: Couldn't find type java.sql.Date. Are you missing a dependency on your classpath? I'm using mongo java driver version 3.8.2, spring boot 2.1 and project is in Java 11. I have no idea what is wrong here could someone help me please? 回答1: Settings -> Build, Execution, Deployment -> Build Tools -> Maven/Gradle -> Runner -> tic on "Delegate IDE

Spring Boot error in setting up SSL connection

∥☆過路亽.° 提交于 2021-02-10 07:10:00
问题 I am trying to connect my Spring Boot application to a PostGresSql database. But every time I get error in setting up SSL connection error. My application.properties file is given below:- server.port=8443 spring.datasource.url=jdbc:postgresql://localhost:5432/testdb spring.datasource.username=postgres spring.datasource.password=1234 spring.datasource.driver-class-name=org.postgresql.Driver spring.datasource.dbcp2.test-while-idle=true server.ssl.key-alias=selfsigned_localhost_sslserver server

How to send MultiPart and RequestBody together In Spring-boot 2.x

北城余情 提交于 2021-02-10 06:57:32
问题 I'm implementing microservices in Spring-boot. I try to send @RequestBody with a MultipartFile together. I refereed some questions in stackoverflow, but nothing helps me. Video class @Data public class Video{ @id ObjectId _id; private String title; private String description; List<String> tags; } Method @PostMapping(RequestUrl.VIDEO_ADD_VIDEO) public ResponseEntity<BulkWriteResult> addNewVideoToCategory( @RequestBody Video video @RequestPart MultipartFile file) { // some logics } In