I create a backend. (in Idea) And before you run the project, you need to configure TomCat to do the following.

1) I go to "Edit Configurations" 2) click on "+" => TomCat Server => local 3) Deoloyment => "+" (And in theory here you need to add Artifacts) but they are not.

Add artifact

I have only 3 classes in the project

public class ApplicationInitializer implements WebApplicationInitializer { private static final String DISPATCHER = "dispatcher"; public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(WebConfig.class); servletContext.addListener(new ContextLoaderListener(ctx)); ServletRegistration.Dynamic servlet = servletContext.addServlet(DISPATCHER, new DispatcherServlet(ctx)); servlet.addMapping("/"); servlet.setLoadOnStartup(1); } } 

Controller

 @Controller @RequestMapping("/reminder") public class ReminderController { @RequestMapping(value = "/get", method = RequestMethod.GET) public String getReminder() { return "may reminder"; } } 

Configuration

 @Configuration @EnableWebMvc @ComponentScan("com.demafayz.spring.app") public class WebConfig extends WebMvcConfigurerAdapter { } 

What needs to be done so that I can specify an artifact?

    1 answer 1

    -> Project structure -> artifacts -> "+" (if we are demolished) -> "Web App Archive" -> Block Available Elements (RMB - name_project -> put into output root) -> If you want, tick the Build on make