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;
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-apiwould just contain the code related to controllers and web, andpom.xmlhave spring web andspring-service-stubdependencies. - The Module
spring-service-serverwill contain the code related to database configuration and all service implementations, andpom.xmlwill contains the database andspring-service-stubdependencies. - and the module
spring-service-stubwill contains only interfaces
and VOs which are used by thespring-apiandspring-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
add a comment |
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-apiwould just contain the code related to controllers and web, andpom.xmlhave spring web andspring-service-stubdependencies. - The Module
spring-service-serverwill contain the code related to database configuration and all service implementations, andpom.xmlwill contains the database andspring-service-stubdependencies. - and the module
spring-service-stubwill contains only interfaces
and VOs which are used by thespring-apiandspring-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
add a comment |
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-apiwould just contain the code related to controllers and web, andpom.xmlhave spring web andspring-service-stubdependencies. - The Module
spring-service-serverwill contain the code related to database configuration and all service implementations, andpom.xmlwill contains the database andspring-service-stubdependencies. - and the module
spring-service-stubwill contains only interfaces
and VOs which are used by thespring-apiandspring-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
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-apiwould just contain the code related to controllers and web, andpom.xmlhave spring web andspring-service-stubdependencies. - The Module
spring-service-serverwill contain the code related to database configuration and all service implementations, andpom.xmlwill contains the database andspring-service-stubdependencies. - and the module
spring-service-stubwill contains only interfaces
and VOs which are used by thespring-apiandspring-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
java spring spring-boot multi-module spring-bean
edited Mar 24 at 14:17
Vinit Solanki
asked Mar 24 at 11:08
Vinit SolankiVinit Solanki
810421
810421
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
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 {
SpringAppApi is under thecom.example.demo.apiand UserController is under thecom.example.demo.api.controller, so for UserController we dont required to add scan, and modulespring-service-stub&spring-service-serverboth have to its own configuration class and its have the@ComponentScan, That configuration class is already added under theSpringAppApiConfige.g@Import(SpringAppStub.class), So don't requied to add componentscan under theSpringAppApi
– Vinit Solanki
Mar 24 at 13:44
Also I have tried to add@ComponentScan(basePackages = "com.example")under theSpringAppApiwhich you mentioned but its not working.
– Vinit Solanki
Mar 24 at 13:45
add a comment |
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.
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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 {
SpringAppApi is under thecom.example.demo.apiand UserController is under thecom.example.demo.api.controller, so for UserController we dont required to add scan, and modulespring-service-stub&spring-service-serverboth have to its own configuration class and its have the@ComponentScan, That configuration class is already added under theSpringAppApiConfige.g@Import(SpringAppStub.class), So don't requied to add componentscan under theSpringAppApi
– Vinit Solanki
Mar 24 at 13:44
Also I have tried to add@ComponentScan(basePackages = "com.example")under theSpringAppApiwhich you mentioned but its not working.
– Vinit Solanki
Mar 24 at 13:45
add a comment |
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 {
SpringAppApi is under thecom.example.demo.apiand UserController is under thecom.example.demo.api.controller, so for UserController we dont required to add scan, and modulespring-service-stub&spring-service-serverboth have to its own configuration class and its have the@ComponentScan, That configuration class is already added under theSpringAppApiConfige.g@Import(SpringAppStub.class), So don't requied to add componentscan under theSpringAppApi
– Vinit Solanki
Mar 24 at 13:44
Also I have tried to add@ComponentScan(basePackages = "com.example")under theSpringAppApiwhich you mentioned but its not working.
– Vinit Solanki
Mar 24 at 13:45
add a comment |
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 {
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 {
answered Mar 24 at 11:24
raviiii1raviiii1
576416
576416
SpringAppApi is under thecom.example.demo.apiand UserController is under thecom.example.demo.api.controller, so for UserController we dont required to add scan, and modulespring-service-stub&spring-service-serverboth have to its own configuration class and its have the@ComponentScan, That configuration class is already added under theSpringAppApiConfige.g@Import(SpringAppStub.class), So don't requied to add componentscan under theSpringAppApi
– Vinit Solanki
Mar 24 at 13:44
Also I have tried to add@ComponentScan(basePackages = "com.example")under theSpringAppApiwhich you mentioned but its not working.
– Vinit Solanki
Mar 24 at 13:45
add a comment |
SpringAppApi is under thecom.example.demo.apiand UserController is under thecom.example.demo.api.controller, so for UserController we dont required to add scan, and modulespring-service-stub&spring-service-serverboth have to its own configuration class and its have the@ComponentScan, That configuration class is already added under theSpringAppApiConfige.g@Import(SpringAppStub.class), So don't requied to add componentscan under theSpringAppApi
– Vinit Solanki
Mar 24 at 13:44
Also I have tried to add@ComponentScan(basePackages = "com.example")under theSpringAppApiwhich 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
add a comment |
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.
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
add a comment |
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.
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
add a comment |
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.
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.
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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