
com.dthoffman.tomcatmock.junit.spring.JokeAppSpringConfig Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of junit-example Show documentation
Show all versions of junit-example Show documentation
Helper code to spin up a tomcat app during tests and mocking downstream http calls
The newest version!
package com.dthoffman.tomcatmock.junit.spring;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.PropertySources;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
@Configuration
@PropertySources({@PropertySource("classpath:/config/${environment:prod}.properties")})
public class JokeAppSpringConfig {
@Bean
static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();
}
@Bean
HttpClient httpClient() {
return HttpClientBuilder.create().build();
}
@Bean
ObjectMapper objectMapper() {
return new ObjectMapper();
}
@Bean
JokeAppController jokeAppController() {
return new JokeAppController();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy