خرید بک لینک

Vote count: 0

I am trying to create a three-tier application with Spring, view, logic, data, more or less. The view depends on logic which depends on data.

How can I configure the Spring application in the view project such that the dependency graph is able to be resolved?

For example:

In the view layer:

@Controller
public class SomeView {
  private final SomeService someService;

  @Autowired
  public SomeView(SomeService someService) {
    this.someService = someService;
  }
}

@Configuration
@EnableAutoConfiguration
@SpringBootApplication
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

}

In the logic layer:

@Component
public class SomeService {

  private final SomeData someData;

  @Autowired
  public SomeService(SomeData someData){
    this.someData = someData;
  }

}

In the data layer:

@Component
public class SomeData {

}

This configuration is not able to boot because SomeService can't resolve SomeData because SomeData is not scaed in the view layers Application.java

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 13 خرداد 1395 ساعت: 0:08

صفحه بندی