maven work
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package com.baeldung;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class MocksApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MocksApplication.class, args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.baeldung;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class NameService {
|
||||
public String getUserName(String id) {
|
||||
return "Real user name";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.baeldung;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class UserService {
|
||||
|
||||
private NameService nameService;
|
||||
|
||||
@Autowired
|
||||
public UserService(NameService nameService) {
|
||||
this.nameService = nameService;
|
||||
}
|
||||
|
||||
public String getUserName(String id) {
|
||||
return nameService.getUserName(id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user