Refactor Spring with Lombok samples
This commit is contained in:
+2
-2
@@ -6,13 +6,13 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class Apologizer {
|
||||
public class ApologizeService {
|
||||
|
||||
private final Translator translator;
|
||||
private final String message;
|
||||
|
||||
@Autowired
|
||||
public Apologizer(Translator translator) {
|
||||
public ApologizeService(Translator translator) {
|
||||
this(translator, "sorry");
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,11 +4,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class Fareweller {
|
||||
public class FarewellService {
|
||||
|
||||
private final Translator translator;
|
||||
|
||||
public Fareweller(Translator translator) {
|
||||
public FarewellService(Translator translator) {
|
||||
this.translator = translator;
|
||||
}
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class Greeter {
|
||||
public class GreetingService {
|
||||
|
||||
@Autowired
|
||||
private Translator translator;
|
||||
+1
-2
@@ -1,12 +1,11 @@
|
||||
package com.baeldung.lombok;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class Thanker {
|
||||
public class ThankingService {
|
||||
|
||||
private final Translator translator;
|
||||
|
||||
Reference in New Issue
Block a user