본문 바로가기

Spring28

[Spring] Spring 4 + Quartz 2 Scheduler Integration Annotation Example using JavaConfig Spring 4 + Quartz 2 Scheduler Integration Annotation Example using JavaConfigBy Arvind Rai, May 28, 2015On this page we will walk through the spring 4 and quartz 2 scheduler integration annotation example using JavaConfig. Spring provides MethodInvokingJobDetailFactoryBean and SimpleTriggerFactoryBean to schedule simple job. We have to create bean for these classes in JavaConfig. The job class a.. 2019. 2. 15.
[Spring] Annotation, Bean, Stereotype, Configuration, Autowired 1. Annotation그냥 찾아보면 주석이라 나오지만 기능이 있으므로 우리가 코드 설명을 위해 붙여놓는 주석과는 차이가 있다.JDK5부터 나왔으며 메타데이터(실제데이터가 아닌 데이터를 위한 데이터)라고도 불린다. 컴파일 또는 런타임에 해석이 된다.설정값들을 명시한다는 점에서 xml과 비슷하지만 xml은 외부에 존재하고, 필요한 경우 이미 빌드한 결과에 재 컴파일할 필요없이 xml에서 설정만 수정하여 변경사항을 적용할 수 있다. 그렇지만 프로그램 작성을 위해 매번 많은 설정파일을 작성해야한다.Annotation은 선언위에 존재해서 어떤 내용인지 쉽게 판단할 수 있으며 작성할 코드의 양도 적은 편인다. 그렇지만 xml도 위에서 말한 장점이 있으므로 annotation을 사용한다고 해서 xml을 아예 사용 .. 2019. 2. 14.
[Spring] @Bean vs @Component @Beanpublic class RedisConfig { private @Value("${spring.redis.host}") String redisHost; private @Value("${spring.redis.port}") int redisPort; private @Value("${spring.redis.password}") String password; @Bean public JedisPoolConfig jedisPoolConfig() { JedisPoolConfig jedisPoolConfig = new JedisPoolConfig(); jedisPoolConfig.setMaxTotal(30); jedisPoolConfig.setTestOnBorrow(true); jedisPoolConfig.s.. 2019. 2. 14.
[Spring] 조건에 따라 필터를 따로 분기해야 할경우. DEXT + SPRING 이미지 업로드시 오류 발생 WebApplicationInitializer @Override public void onStartup(ServletContext container) { // for dexteditor AnnotationConfigWebApplicationContext dextContext = new AnnotationConfigWebApplicationContext(); //dextContext.setConfigLocation(CONFIG_LOCATION); //container.addListener(new ContextLoaderListener(dextContext)); DispatcherServlet dextServlet = new DispatcherServlet(dextContext); dextServlet.se.. 2019. 2. 13.