-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
92 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
adapter/input/jaxrs-controller-v1/src/main/java/br/com/helpdev/controller/dto/ErrorDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
app/spring-app/src/main/java/br/com/helpdev/SpringSampleApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
app/spring-app/src/main/java/br/com/helpdev/config/ObjectMapperConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package br.com.helpdev.config; | ||
|
||
import br.com.helpdev.controller.config.CustomObjectMapperConfig; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; | ||
|
||
@Configuration | ||
public class ObjectMapperConfig { | ||
|
||
@Bean | ||
public ObjectMapper objectMapper(final Jackson2ObjectMapperBuilder builder) { | ||
final var objectMapper = builder.build(); | ||
CustomObjectMapperConfig.customize(objectMapper); | ||
return objectMapper; | ||
} | ||
} |
21 changes: 12 additions & 9 deletions
21
app/spring-app/src/main/java/br/com/helpdev/config/WebJerseyConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,30 @@ | ||
package br.com.helpdev.config; | ||
|
||
import java.util.Objects; | ||
import java.util.stream.Collectors; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.ext.Provider; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.glassfish.jersey.server.ResourceConfig; | ||
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.core.type.filter.AnnotationTypeFilter; | ||
import org.springframework.util.ClassUtils; | ||
|
||
@Configuration | ||
@Slf4j | ||
public class WebJerseyConfiguration extends ResourceConfig { | ||
|
||
public WebJerseyConfiguration() { | ||
var scanner = new ClassPathScanningCandidateComponentProvider(false); | ||
scanner.addIncludeFilter(new AnnotationTypeFilter(Provider.class)); | ||
scanner.addIncludeFilter(new AnnotationTypeFilter(Path.class)); | ||
scanner.findCandidateComponents("br.com.helpdev.controller").forEach(beanDefinition -> { | ||
try { | ||
register(Class.forName(beanDefinition.getBeanClassName())); | ||
} catch (ClassNotFoundException e) { | ||
log.warn("Failed to register: {}", beanDefinition.getBeanClassName()); | ||
} | ||
}); | ||
registerClasses( | ||
scanner.findCandidateComponents("br.com.helpdev.controller").stream() | ||
.map( | ||
beanDefinition -> | ||
ClassUtils.resolveClassName( | ||
Objects.requireNonNull(beanDefinition.getBeanClassName()), | ||
getClassLoader())) | ||
.collect(Collectors.toSet())); | ||
|
||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
app/spring-app/src/main/java/br/com/helpdev/protocolgenerator/FakeProtocolGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package br.com.helpdev.protocolgenerator; | ||
|
||
import br.com.helpdev.usecase.port.ProtocolGeneratorClient; | ||
import java.util.Random; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class FakeProtocolGenerator implements ProtocolGeneratorClient { | ||
|
||
public static final Random RANDOM = new Random(); | ||
|
||
@Override | ||
public String generateNewProtocol() { | ||
return "PROT-" + RANDOM.nextInt(Integer.MAX_VALUE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters