Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Improved classpath scanning for configuration classes.

Introduced App marker interface to allow referencing that in the JavaConfig class to pick up configuration classes for the entire application.
  • Loading branch information...
commit 7277a44085698d8dafb002b2edaf9c26edd6b3a8 1 parent 049be68
Oliver Gierke authored
4 hera-sample/app/src/test/java/de/olivergierke/whoops/hera/app/JavaConfigTest.java
@@ -17,15 +17,13 @@
17 17 import de.olivergierke.whoops.hera.core.Result;
18 18 import de.olivergierke.whoops.hera.core.UnsupportedInstrumentException;
19 19 import de.olivergierke.whoops.hera.equities.Equity;
20   -import de.olivergierke.whoops.hera.equities.EquityConfig;
21 20 import de.olivergierke.whoops.hera.options.Option;
22   -import de.olivergierke.whoops.hera.options.OptionConfig;
23 21
24 22 /**
25 23 * Integration test using JavaConfig.
26 24 */
27 25 @RunWith(SpringJUnit4ClassRunner.class)
28   -@ContextConfiguration(classes = { CoreConfig.class, EquityConfig.class, OptionConfig.class })
  26 +@ContextConfiguration(classes = { CoreConfig.class })
29 27 public class JavaConfigTest {
30 28
31 29 @Autowired
28 hera-sample/core/src/main/java/de/olivergierke/whoops/hera/App.java
... ... @@ -0,0 +1,28 @@
  1 +/*
  2 + * Copyright 2012 the original author or authors.
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +package de.olivergierke.whoops.hera;
  17 +
  18 +import de.olivergierke.whoops.hera.core.CoreConfig;
  19 +
  20 +/**
  21 + * Marker interface to allow component scanning to refer to the root package of the application.
  22 + *
  23 + * @see CoreConfig
  24 + * @author Oliver Gierke
  25 + */
  26 +public interface App {
  27 +
  28 +}
3  hera-sample/core/src/main/java/de/olivergierke/whoops/hera/core/CoreConfig.java
@@ -23,6 +23,7 @@
23 23 import org.springframework.plugin.core.PluginRegistry;
24 24 import org.springframework.plugin.core.support.PluginRegistryFactoryBean;
25 25
  26 +import de.olivergierke.whoops.hera.App;
26 27
27 28 /**
28 29 * Configuration for core components.
@@ -30,7 +31,7 @@
30 31 * @author Oliver Gierke
31 32 */
32 33 @Configuration
33   -@ComponentScan(basePackageClasses = CoreConfig.class)
  34 +@ComponentScan(basePackageClasses = App.class)
34 35 public class CoreConfig {
35 36
36 37 @Autowired

0 comments on commit 7277a44

Please sign in to comment.
Something went wrong with that request. Please try again.