fork download
  1. import java.time.LocalTime;
  2. import org.springframework.context.annotation.ComponentScan;
  3. import org.springframework.context.annotation.Configuration;
  4. import org.springframework.scheduling.annotation.EnableScheduling;
  5. import org.springframework.scheduling.annotation.Scheduled;
  6. import org.springframework.web.servlet.config.annotation.EnableWebMvc;
  7. import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
  8. import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
  9.  
  10. @Configuration
  11. @EnableWebMvc
  12. @EnableScheduling
  13. @ComponentScan({"ru.web.portal.onlinescheduling"})
  14. public class WebConfig extends WebMvcConfigurerAdapter {
  15.  
  16. @Scheduled(fixedDelay = 3000)
  17. public void time() {
  18. System.out.printf("%s\n", LocalTime.now());
  19. }
  20.  
  21. public static class MvcWebApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
  22.  
  23.  
  24. @Override
  25. protected Class<?>[] getRootConfigClasses() {
  26. return new Class[]{WebConfig.class};
  27. }
  28.  
  29. @Override
  30. protected Class<?>[] getServletConfigClasses() {
  31. //return new Class[]{WebConfig.class};
  32. return null;
  33. }
  34.  
  35. @Override
  36. protected String[] getServletMappings() {
  37. return new String[]{"/"};
  38.  
  39. }
  40. }
  41.  
  42. }
  43.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:14: error: class WebConfig is public, should be declared in a file named WebConfig.java
public class WebConfig extends WebMvcConfigurerAdapter {
       ^
Main.java:2: error: package org.springframework.context.annotation does not exist
import org.springframework.context.annotation.ComponentScan;
                                             ^
Main.java:3: error: package org.springframework.context.annotation does not exist
import org.springframework.context.annotation.Configuration;
                                             ^
Main.java:4: error: package org.springframework.scheduling.annotation does not exist
import org.springframework.scheduling.annotation.EnableScheduling;
                                                ^
Main.java:5: error: package org.springframework.scheduling.annotation does not exist
import org.springframework.scheduling.annotation.Scheduled;
                                                ^
Main.java:6: error: package org.springframework.web.servlet.config.annotation does not exist
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
                                                        ^
Main.java:7: error: package org.springframework.web.servlet.config.annotation does not exist
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
                                                        ^
Main.java:8: error: package org.springframework.web.servlet.support does not exist
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
                                              ^
Main.java:14: error: cannot find symbol
public class WebConfig extends WebMvcConfigurerAdapter {
                               ^
  symbol: class WebMvcConfigurerAdapter
Main.java:10: error: cannot find symbol
@Configuration
 ^
  symbol: class Configuration
Main.java:11: error: cannot find symbol
@EnableWebMvc
 ^
  symbol: class EnableWebMvc
Main.java:12: error: cannot find symbol
@EnableScheduling
 ^
  symbol: class EnableScheduling
Main.java:13: error: cannot find symbol
@ComponentScan({"ru.web.portal.onlinescheduling"})
 ^
  symbol: class ComponentScan
Main.java:21: error: cannot find symbol
    public static class MvcWebApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
                                                             ^
  symbol:   class AbstractAnnotationConfigDispatcherServletInitializer
  location: class WebConfig
Main.java:16: error: cannot find symbol
    @Scheduled(fixedDelay = 3000)
     ^
  symbol:   class Scheduled
  location: class WebConfig
Main.java:24: error: method does not override or implement a method from a supertype
        @Override
        ^
Main.java:29: error: method does not override or implement a method from a supertype
        @Override
        ^
Main.java:35: error: method does not override or implement a method from a supertype
        @Override
        ^
18 errors
stdout
Standard output is empty