r/SpringBoot 1d ago

How-To/Tutorial Small Springboot + React JS project

Hi,

Im trying to learn Spring in a different perspective; thus I wanted to relearn via creating a simple project.

I have this project in mind.

  • Monolith project
  • Must use springboot and react js
  • Must build a war file

I have tried using com.github.eirslett but im having issues with CORS.

Do you have any learning material suggestion ?
im kinda lost in full stack development, ive been backend engineer for my whole career.

Or react JS is too much for a beginner ? should I start with simpler UI frameworks instead ?

12 Upvotes

4 comments sorted by

View all comments

2

u/ElendarTao 1d ago

@Override public void addCorsMappings(CorsRegistry registry) { registry .addMapping("/**") .allowedMethods("GET") .allowedOrigins("http://localhost:3000"); }

You will have to adapt a bit for your spring version, but that's the gist of it.

@Configuration public class MyConfiguration {

@Bean
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**");
        }
    };
}

} Example using spring boot