Spring Boot Separate modules for api, interface and implementationAutowiring two beans implementing same interface - how to set default bean to autowire?maven - separate modules for interfaces and implementation with SpringHow to configure port for a Spring Boot applicationSpring boot jar does not detect beans defined in dependent modulesSpring DATA JPA and REST repository in separate related modules (Spring Boot)Spring boot configuration in a multi-Module maven project intellijSpring boot maven multi module project with Spring DataSpring Boot Autowiring of beans is not working in maven multi module projectAutowiring bean in Spring Boot Scheduler AppSpring Boot Application

Expenditure in Poland - Forex doesn't have Zloty

Did airlines fly their aircraft slower in response to oil prices in the 1970s?

Select row of data if next row contains zero

What caused the tendency for conservatives to not support climate change regulations?

Future enhancements for the finite element method

Why use water tanks from a retired Space Shuttle?

Double integral bounds of integration polar change of coordinate

Site-specific value for an appsetting in a multisite solution

Attempted proof at P vs NP

Is there a way to save this session?

Can a non-EU citizen travel freely within the Schengen area without passport?

Is there a rule that prohibits us from using 2 possessives in a row?

Is there any Biblical Basis for 400 years of silence between Old and New Testament?

If Sweden was to magically float away, at what altitude would it be visible from the southern hemisphere?

Term for checking piece whose opponent daren't capture it

Change TeXForm of ArcTan

What does War Machine's "Canopy! Canopy!" line mean in "Avengers: Endgame"?

How should I push back against my job assigning "homework"?

What is the purpose of std::forward()'s rvalue reference overload?

How to properly maintain eye contact with people that have distinctive facial features?

How can an eldritch abomination hide its true form in public?

Can a rogue effectively triple their speed by combining Dash and Ready?

Looking after a wayward brother in mother's will

What is the intuition behind uniform continuity?



Spring Boot Separate modules for api, interface and implementation


Autowiring two beans implementing same interface - how to set default bean to autowire?maven - separate modules for interfaces and implementation with SpringHow to configure port for a Spring Boot applicationSpring boot jar does not detect beans defined in dependent modulesSpring DATA JPA and REST repository in separate related modules (Spring Boot)Spring boot configuration in a multi-Module maven project intellijSpring boot maven multi module project with Spring DataSpring Boot Autowiring of beans is not working in maven multi module projectAutowiring bean in Spring Boot Scheduler AppSpring Boot Application






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am trying to build one project which has three sub-modules for api(web), interface and implementation.



Directory tree structure is like



spring-multi-module
--spring-api
--spring-service-server
--spring-service-stub


  • An idea is module spring-api would just contain the code related to controllers and web, and pom.xml have spring web and spring-service-stub dependencies.

  • The Module spring-service-server will contain the code related to database configuration and all service implementations, and pom.xml will contains the database and spring-service-stub dependencies.

  • and the module spring-service-stub will contains only interfaces
    and VOs which are used by the spring-api and spring-service-server.

pom.xml file of the spring-multi-module



<modules>
<module>spring-api</module>
<module>spring-service-server</module>
<module>spring-service-stub</module>
</modules>

<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<packaging>pom</packaging>

<properties>
<java.version>1.8</java.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>1.5.3.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</dependency>
</dependencies>


pom.xml of spring-api



<parent>
<artifactId>demo</artifactId>
<groupId>com.example</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>spring-api</artifactId>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.example</groupId>
<artifactId>spring-service-stub</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>


UserSerivce.java is the interface in spring-service-stub module and its implementation is on the spring-service-server module. UserController.java have the autowired UserService object.



And the problem is when I am trying to run the SpringBootApplication class from the spring-api then gets the below error on log



***************************
APPLICATION FAILED TO START
***************************

Description:

Field userService in com.example.demo.api.controller.UserController required a bean of type 'com.example.demo.service.UserService' that could not be found.


Action:

Consider defining a bean of type 'com.example.demo.service.UserService' in your configuration.


Full code also added on github, you can find from https://github.com/vinitsolanki/spring-multi-module



Simply if I add use @Import(SpringAppStub.class, SpringAppServer.class) instead of @Import(SpringAppStub.class) in SpringAppApiConfig then also its works, It means I am spreading all entities and repository to the spring-api module which I don't want to.










share|improve this question






























    0















    I am trying to build one project which has three sub-modules for api(web), interface and implementation.



    Directory tree structure is like



    spring-multi-module
    --spring-api
    --spring-service-server
    --spring-service-stub


    • An idea is module spring-api would just contain the code related to controllers and web, and pom.xml have spring web and spring-service-stub dependencies.

    • The Module spring-service-server will contain the code related to database configuration and all service implementations, and pom.xml will contains the database and spring-service-stub dependencies.

    • and the module spring-service-stub will contains only interfaces
      and VOs which are used by the spring-api and spring-service-server.

    pom.xml file of the spring-multi-module



    <modules>
    <module>spring-api</module>
    <module>spring-service-server</module>
    <module>spring-service-stub</module>
    </modules>

    <groupId>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo</name>
    <description>Demo project for Spring Boot</description>
    <packaging>pom</packaging>

    <properties>
    <java.version>1.8</java.version>
    </properties>

    <dependencyManagement>
    <dependencies>
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-dependencies</artifactId>
    <version>1.5.3.RELEASE</version>
    <type>pom</type>
    <scope>import</scope>
    </dependency>
    </dependencies>
    </dependencyManagement>

    <dependencies>
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter</artifactId>
    </dependency>
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-logging</artifactId>
    </dependency>
    </dependencies>


    pom.xml of spring-api



    <parent>
    <artifactId>demo</artifactId>
    <groupId>com.example</groupId>
    <version>0.0.1-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>spring-api</artifactId>

    <dependencies>
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
    <groupId>com.example</groupId>
    <artifactId>spring-service-stub</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    </dependency>
    </dependencies>


    UserSerivce.java is the interface in spring-service-stub module and its implementation is on the spring-service-server module. UserController.java have the autowired UserService object.



    And the problem is when I am trying to run the SpringBootApplication class from the spring-api then gets the below error on log



    ***************************
    APPLICATION FAILED TO START
    ***************************

    Description:

    Field userService in com.example.demo.api.controller.UserController required a bean of type 'com.example.demo.service.UserService' that could not be found.


    Action:

    Consider defining a bean of type 'com.example.demo.service.UserService' in your configuration.


    Full code also added on github, you can find from https://github.com/vinitsolanki/spring-multi-module



    Simply if I add use @Import(SpringAppStub.class, SpringAppServer.class) instead of @Import(SpringAppStub.class) in SpringAppApiConfig then also its works, It means I am spreading all entities and repository to the spring-api module which I don't want to.










    share|improve this question


























      0












      0








      0


      1






      I am trying to build one project which has three sub-modules for api(web), interface and implementation.



      Directory tree structure is like



      spring-multi-module
      --spring-api
      --spring-service-server
      --spring-service-stub


      • An idea is module spring-api would just contain the code related to controllers and web, and pom.xml have spring web and spring-service-stub dependencies.

      • The Module spring-service-server will contain the code related to database configuration and all service implementations, and pom.xml will contains the database and spring-service-stub dependencies.

      • and the module spring-service-stub will contains only interfaces
        and VOs which are used by the spring-api and spring-service-server.

      pom.xml file of the spring-multi-module



      <modules>
      <module>spring-api</module>
      <module>spring-service-server</module>
      <module>spring-service-stub</module>
      </modules>

      <groupId>com.example</groupId>
      <artifactId>demo</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <name>demo</name>
      <description>Demo project for Spring Boot</description>
      <packaging>pom</packaging>

      <properties>
      <java.version>1.8</java.version>
      </properties>

      <dependencyManagement>
      <dependencies>
      <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-dependencies</artifactId>
      <version>1.5.3.RELEASE</version>
      <type>pom</type>
      <scope>import</scope>
      </dependency>
      </dependencies>
      </dependencyManagement>

      <dependencies>
      <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter</artifactId>
      </dependency>
      <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-logging</artifactId>
      </dependency>
      </dependencies>


      pom.xml of spring-api



      <parent>
      <artifactId>demo</artifactId>
      <groupId>com.example</groupId>
      <version>0.0.1-SNAPSHOT</version>
      </parent>
      <modelVersion>4.0.0</modelVersion>

      <artifactId>spring-api</artifactId>

      <dependencies>
      <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
      </dependency>
      <dependency>
      <groupId>com.example</groupId>
      <artifactId>spring-service-stub</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      </dependency>
      </dependencies>


      UserSerivce.java is the interface in spring-service-stub module and its implementation is on the spring-service-server module. UserController.java have the autowired UserService object.



      And the problem is when I am trying to run the SpringBootApplication class from the spring-api then gets the below error on log



      ***************************
      APPLICATION FAILED TO START
      ***************************

      Description:

      Field userService in com.example.demo.api.controller.UserController required a bean of type 'com.example.demo.service.UserService' that could not be found.


      Action:

      Consider defining a bean of type 'com.example.demo.service.UserService' in your configuration.


      Full code also added on github, you can find from https://github.com/vinitsolanki/spring-multi-module



      Simply if I add use @Import(SpringAppStub.class, SpringAppServer.class) instead of @Import(SpringAppStub.class) in SpringAppApiConfig then also its works, It means I am spreading all entities and repository to the spring-api module which I don't want to.










      share|improve this question
















      I am trying to build one project which has three sub-modules for api(web), interface and implementation.



      Directory tree structure is like



      spring-multi-module
      --spring-api
      --spring-service-server
      --spring-service-stub


      • An idea is module spring-api would just contain the code related to controllers and web, and pom.xml have spring web and spring-service-stub dependencies.

      • The Module spring-service-server will contain the code related to database configuration and all service implementations, and pom.xml will contains the database and spring-service-stub dependencies.

      • and the module spring-service-stub will contains only interfaces
        and VOs which are used by the spring-api and spring-service-server.

      pom.xml file of the spring-multi-module



      <modules>
      <module>spring-api</module>
      <module>spring-service-server</module>
      <module>spring-service-stub</module>
      </modules>

      <groupId>com.example</groupId>
      <artifactId>demo</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <name>demo</name>
      <description>Demo project for Spring Boot</description>
      <packaging>pom</packaging>

      <properties>
      <java.version>1.8</java.version>
      </properties>

      <dependencyManagement>
      <dependencies>
      <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-dependencies</artifactId>
      <version>1.5.3.RELEASE</version>
      <type>pom</type>
      <scope>import</scope>
      </dependency>
      </dependencies>
      </dependencyManagement>

      <dependencies>
      <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter</artifactId>
      </dependency>
      <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-logging</artifactId>
      </dependency>
      </dependencies>


      pom.xml of spring-api



      <parent>
      <artifactId>demo</artifactId>
      <groupId>com.example</groupId>
      <version>0.0.1-SNAPSHOT</version>
      </parent>
      <modelVersion>4.0.0</modelVersion>

      <artifactId>spring-api</artifactId>

      <dependencies>
      <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
      </dependency>
      <dependency>
      <groupId>com.example</groupId>
      <artifactId>spring-service-stub</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      </dependency>
      </dependencies>


      UserSerivce.java is the interface in spring-service-stub module and its implementation is on the spring-service-server module. UserController.java have the autowired UserService object.



      And the problem is when I am trying to run the SpringBootApplication class from the spring-api then gets the below error on log



      ***************************
      APPLICATION FAILED TO START
      ***************************

      Description:

      Field userService in com.example.demo.api.controller.UserController required a bean of type 'com.example.demo.service.UserService' that could not be found.


      Action:

      Consider defining a bean of type 'com.example.demo.service.UserService' in your configuration.


      Full code also added on github, you can find from https://github.com/vinitsolanki/spring-multi-module



      Simply if I add use @Import(SpringAppStub.class, SpringAppServer.class) instead of @Import(SpringAppStub.class) in SpringAppApiConfig then also its works, It means I am spreading all entities and repository to the spring-api module which I don't want to.







      java spring spring-boot multi-module spring-bean






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 24 at 14:17







      Vinit Solanki

















      asked Mar 24 at 11:08









      Vinit SolankiVinit Solanki

      810421




      810421






















          2 Answers
          2






          active

          oldest

          votes


















          1














          By default, Spring scans all classes in the sub package of @SpringBootApplication class. Since the UserController, UserService etc. classes are not in the sub-packages you need to add



          @ComponentScan(basePackages = "com.example")
          @SpringBootApplication
          public class SpringAppApi {





          share|improve this answer























          • SpringAppApi is under the com.example.demo.api and UserController is under the com.example.demo.api.controller, so for UserController we dont required to add scan, and module spring-service-stub & spring-service-server both have to its own configuration class and its have the @ComponentScan, That configuration class is already added under the SpringAppApiConfig e.g @Import(SpringAppStub.class) , So don't requied to add componentscan under the SpringAppApi

            – Vinit Solanki
            Mar 24 at 13:44












          • Also I have tried to add @ComponentScan(basePackages = "com.example") under the SpringAppApi which you mentioned but its not working.

            – Vinit Solanki
            Mar 24 at 13:45


















          0














          In your project you have 3 modules



          spring-api 
          spring-service-server
          spring-service-stub


          spring-service-server is dependent on spring-service-stub



          spring-api is dependent on spring-service-stub



          If you see this setup there is no involvement of spring-service-server



          Ideally, it should be like this



          spring-api should be dependent on spring-service-server



          You can change your spring-api => pom.xml



          remove stub dependency and add



          <dependency>
          <groupId>com.example</groupId>
          <artifactId>spring-service-server</artifactId>
          <version>0.0.1-SNAPSHOT</version>
          </dependency>


          And all should work just fine.






          share|improve this answer























          • Yes but If I do it then I am spreading all entities and repository to the spring-api module which I don't want. My all controllers will never use the Entities and repositories directly, I want to restrict the usage these from the controller, that's why I have created three modules.

            – Vinit Solanki
            Mar 25 at 12:26












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55323162%2fspring-boot-separate-modules-for-api-interface-and-implementation%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          By default, Spring scans all classes in the sub package of @SpringBootApplication class. Since the UserController, UserService etc. classes are not in the sub-packages you need to add



          @ComponentScan(basePackages = "com.example")
          @SpringBootApplication
          public class SpringAppApi {





          share|improve this answer























          • SpringAppApi is under the com.example.demo.api and UserController is under the com.example.demo.api.controller, so for UserController we dont required to add scan, and module spring-service-stub & spring-service-server both have to its own configuration class and its have the @ComponentScan, That configuration class is already added under the SpringAppApiConfig e.g @Import(SpringAppStub.class) , So don't requied to add componentscan under the SpringAppApi

            – Vinit Solanki
            Mar 24 at 13:44












          • Also I have tried to add @ComponentScan(basePackages = "com.example") under the SpringAppApi which you mentioned but its not working.

            – Vinit Solanki
            Mar 24 at 13:45















          1














          By default, Spring scans all classes in the sub package of @SpringBootApplication class. Since the UserController, UserService etc. classes are not in the sub-packages you need to add



          @ComponentScan(basePackages = "com.example")
          @SpringBootApplication
          public class SpringAppApi {





          share|improve this answer























          • SpringAppApi is under the com.example.demo.api and UserController is under the com.example.demo.api.controller, so for UserController we dont required to add scan, and module spring-service-stub & spring-service-server both have to its own configuration class and its have the @ComponentScan, That configuration class is already added under the SpringAppApiConfig e.g @Import(SpringAppStub.class) , So don't requied to add componentscan under the SpringAppApi

            – Vinit Solanki
            Mar 24 at 13:44












          • Also I have tried to add @ComponentScan(basePackages = "com.example") under the SpringAppApi which you mentioned but its not working.

            – Vinit Solanki
            Mar 24 at 13:45













          1












          1








          1







          By default, Spring scans all classes in the sub package of @SpringBootApplication class. Since the UserController, UserService etc. classes are not in the sub-packages you need to add



          @ComponentScan(basePackages = "com.example")
          @SpringBootApplication
          public class SpringAppApi {





          share|improve this answer













          By default, Spring scans all classes in the sub package of @SpringBootApplication class. Since the UserController, UserService etc. classes are not in the sub-packages you need to add



          @ComponentScan(basePackages = "com.example")
          @SpringBootApplication
          public class SpringAppApi {






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 24 at 11:24









          raviiii1raviiii1

          576416




          576416












          • SpringAppApi is under the com.example.demo.api and UserController is under the com.example.demo.api.controller, so for UserController we dont required to add scan, and module spring-service-stub & spring-service-server both have to its own configuration class and its have the @ComponentScan, That configuration class is already added under the SpringAppApiConfig e.g @Import(SpringAppStub.class) , So don't requied to add componentscan under the SpringAppApi

            – Vinit Solanki
            Mar 24 at 13:44












          • Also I have tried to add @ComponentScan(basePackages = "com.example") under the SpringAppApi which you mentioned but its not working.

            – Vinit Solanki
            Mar 24 at 13:45

















          • SpringAppApi is under the com.example.demo.api and UserController is under the com.example.demo.api.controller, so for UserController we dont required to add scan, and module spring-service-stub & spring-service-server both have to its own configuration class and its have the @ComponentScan, That configuration class is already added under the SpringAppApiConfig e.g @Import(SpringAppStub.class) , So don't requied to add componentscan under the SpringAppApi

            – Vinit Solanki
            Mar 24 at 13:44












          • Also I have tried to add @ComponentScan(basePackages = "com.example") under the SpringAppApi which you mentioned but its not working.

            – Vinit Solanki
            Mar 24 at 13:45
















          SpringAppApi is under the com.example.demo.api and UserController is under the com.example.demo.api.controller, so for UserController we dont required to add scan, and module spring-service-stub & spring-service-server both have to its own configuration class and its have the @ComponentScan, That configuration class is already added under the SpringAppApiConfig e.g @Import(SpringAppStub.class) , So don't requied to add componentscan under the SpringAppApi

          – Vinit Solanki
          Mar 24 at 13:44






          SpringAppApi is under the com.example.demo.api and UserController is under the com.example.demo.api.controller, so for UserController we dont required to add scan, and module spring-service-stub & spring-service-server both have to its own configuration class and its have the @ComponentScan, That configuration class is already added under the SpringAppApiConfig e.g @Import(SpringAppStub.class) , So don't requied to add componentscan under the SpringAppApi

          – Vinit Solanki
          Mar 24 at 13:44














          Also I have tried to add @ComponentScan(basePackages = "com.example") under the SpringAppApi which you mentioned but its not working.

          – Vinit Solanki
          Mar 24 at 13:45





          Also I have tried to add @ComponentScan(basePackages = "com.example") under the SpringAppApi which you mentioned but its not working.

          – Vinit Solanki
          Mar 24 at 13:45













          0














          In your project you have 3 modules



          spring-api 
          spring-service-server
          spring-service-stub


          spring-service-server is dependent on spring-service-stub



          spring-api is dependent on spring-service-stub



          If you see this setup there is no involvement of spring-service-server



          Ideally, it should be like this



          spring-api should be dependent on spring-service-server



          You can change your spring-api => pom.xml



          remove stub dependency and add



          <dependency>
          <groupId>com.example</groupId>
          <artifactId>spring-service-server</artifactId>
          <version>0.0.1-SNAPSHOT</version>
          </dependency>


          And all should work just fine.






          share|improve this answer























          • Yes but If I do it then I am spreading all entities and repository to the spring-api module which I don't want. My all controllers will never use the Entities and repositories directly, I want to restrict the usage these from the controller, that's why I have created three modules.

            – Vinit Solanki
            Mar 25 at 12:26
















          0














          In your project you have 3 modules



          spring-api 
          spring-service-server
          spring-service-stub


          spring-service-server is dependent on spring-service-stub



          spring-api is dependent on spring-service-stub



          If you see this setup there is no involvement of spring-service-server



          Ideally, it should be like this



          spring-api should be dependent on spring-service-server



          You can change your spring-api => pom.xml



          remove stub dependency and add



          <dependency>
          <groupId>com.example</groupId>
          <artifactId>spring-service-server</artifactId>
          <version>0.0.1-SNAPSHOT</version>
          </dependency>


          And all should work just fine.






          share|improve this answer























          • Yes but If I do it then I am spreading all entities and repository to the spring-api module which I don't want. My all controllers will never use the Entities and repositories directly, I want to restrict the usage these from the controller, that's why I have created three modules.

            – Vinit Solanki
            Mar 25 at 12:26














          0












          0








          0







          In your project you have 3 modules



          spring-api 
          spring-service-server
          spring-service-stub


          spring-service-server is dependent on spring-service-stub



          spring-api is dependent on spring-service-stub



          If you see this setup there is no involvement of spring-service-server



          Ideally, it should be like this



          spring-api should be dependent on spring-service-server



          You can change your spring-api => pom.xml



          remove stub dependency and add



          <dependency>
          <groupId>com.example</groupId>
          <artifactId>spring-service-server</artifactId>
          <version>0.0.1-SNAPSHOT</version>
          </dependency>


          And all should work just fine.






          share|improve this answer













          In your project you have 3 modules



          spring-api 
          spring-service-server
          spring-service-stub


          spring-service-server is dependent on spring-service-stub



          spring-api is dependent on spring-service-stub



          If you see this setup there is no involvement of spring-service-server



          Ideally, it should be like this



          spring-api should be dependent on spring-service-server



          You can change your spring-api => pom.xml



          remove stub dependency and add



          <dependency>
          <groupId>com.example</groupId>
          <artifactId>spring-service-server</artifactId>
          <version>0.0.1-SNAPSHOT</version>
          </dependency>


          And all should work just fine.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 25 at 6:57









          MyTwoCentsMyTwoCents

          3,57521130




          3,57521130












          • Yes but If I do it then I am spreading all entities and repository to the spring-api module which I don't want. My all controllers will never use the Entities and repositories directly, I want to restrict the usage these from the controller, that's why I have created three modules.

            – Vinit Solanki
            Mar 25 at 12:26


















          • Yes but If I do it then I am spreading all entities and repository to the spring-api module which I don't want. My all controllers will never use the Entities and repositories directly, I want to restrict the usage these from the controller, that's why I have created three modules.

            – Vinit Solanki
            Mar 25 at 12:26

















          Yes but If I do it then I am spreading all entities and repository to the spring-api module which I don't want. My all controllers will never use the Entities and repositories directly, I want to restrict the usage these from the controller, that's why I have created three modules.

          – Vinit Solanki
          Mar 25 at 12:26






          Yes but If I do it then I am spreading all entities and repository to the spring-api module which I don't want. My all controllers will never use the Entities and repositories directly, I want to restrict the usage these from the controller, that's why I have created three modules.

          – Vinit Solanki
          Mar 25 at 12:26


















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55323162%2fspring-boot-separate-modules-for-api-interface-and-implementation%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

          155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해