Code Monkey home page Code Monkey logo

Comments (2)

TrickAndTrack avatar TrickAndTrack commented on August 23, 2024 1

can you assign this to me would like to work on this!

from spring-chatting-server.

ghkdqhrbals avatar ghkdqhrbals commented on August 23, 2024

Hello @TrickAndTrack and sure!

But BeanDefinitionOverrideException in SpringWebSecurity was already solved by adding spring.main.web-application-type : reactive in application.yaml file in shop-user-service.

And BeanDefinitionOverrideException in JPA&Redis Repository was also solved by excluding WebMvcAutoConfiguration.class and scanning JPA and RedisRespotory in different path.

Here is the sample code for solving JPA&Redis Repository BeanDefinitionOverrideException.

...
@SpringBootApplication(scanBasePackages = "com.example",exclude={DataSourceAutoConfiguration.class,WebMvcAutoConfiguration.class})
@EnableJpaRepositories(basePackages = {"com.example.shopuserservice.domain.user.repository"})
@EnableRedisRepositories(basePackages = {"com.example.shopuserservice.domain.user.redisrepository"})
@EnableDiscoveryClient
@EnableFeignClients
@Import(JpaConfig.class)
@EnableKafka
@EnableWebFlux
public class MainApplication {

	public static void main(String[] args) {
		SpringApplication.run(OrderServiceApplication.class, args);
	}

	@Bean
	public Logger.Level feignLoggerLevel(){
		return Logger.Level.FULL;
	}
	@Bean
	public HttpExchangeRepository httpTraceRepository(){
		return new InMemoryHttpExchangeRepository();
	}

	@Bean(name = "bcrypt")
	PasswordEncoder passwordEncoder() {
		return new BCryptPasswordEncoder();
	}

	@Bean
	public FeignErrorDecoder getFeignErrorDecoder(){
		return new FeignErrorDecoder();
	}


}

Why BeanDefinitionOverrideException is occured in SpringWebSecurity?

The main reason I found is that our web security configuration is currently setting as reactiveSecurity which is not mvcSecurity. If our server doesn't set any web-application-type in application.yaml, Spring automatically set our service as normal mvc pattern to web server and security.

So spring tries to set it as mvcSecurity, but we want to set it as reactiveSecurity, so it crashes.

To solve this problem, we add spring.main.web-application-type : reactive in application.yaml file. And we finally solve BeanDefinitionOverrideException occured in SpringWebSecurity.

If you have any questions OR want to contribute this project, please contact!

from spring-chatting-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.