Commit dfb23002 authored by Noel Alonso's avatar Noel Alonso
Browse files

Actualiza spring boot y kafka

Además arregla problemas derivados de la actualización
parent 5056d66f
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.0.3.RELEASE</version>
		<version>2.1.0.RELEASE</version>
		<relativePath />
	</parent>

@@ -38,7 +38,8 @@
		
		<!-- OTHER -->
		<powermock.version>1.7.3</powermock.version>
		<kafka.version>1.1.0</kafka.version>
		<kafka.version>2.0.0</kafka.version>
		<elasticsearch.version>5.6.1</elasticsearch.version>
		
		<!-- Plugins -->
		<jacoco.version>0.8.1</jacoco.version>
+6 −10
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@ import org.springframework.batch.core.configuration.annotation.EnableBatchProces
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
import org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor;
import org.springframework.batch.core.configuration.support.MapJobRegistry;
import org.springframework.batch.core.explore.JobExplorer;
import org.springframework.batch.core.explore.support.JobExplorerFactoryBean;
import org.springframework.batch.core.launch.JobLauncher;
@@ -17,6 +16,7 @@ import org.springframework.batch.core.launch.support.SimpleJobLauncher;
import org.springframework.batch.core.launch.support.SimpleJobOperator;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.core.repository.support.JobRepositoryFactoryBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
@@ -31,6 +31,9 @@ import org.springframework.validation.annotation.Validated;
@EnableBatchProcessing
public class JobConfig implements BatchConfigurer {

	@Autowired
	JobRegistry jobRegistry;

	@Bean
	@Validated
	@ConfigurationProperties(prefix = "jobs.datasource")
@@ -39,13 +42,6 @@ public class JobConfig implements BatchConfigurer {
		return DataSourceBuilder.create().build();
	}

	@Bean
	public JobRegistry jobRegistry() {
		JobRegistry jobRegistry = new MapJobRegistry();

		return jobRegistry;
	}

	@Bean
	public StepBuilderFactory stepBuilderFactory() throws Exception {
		StepBuilderFactory stepBuilderFactory = new StepBuilderFactory(getJobRepository(), getTransactionManager());
@@ -72,7 +68,7 @@ public class JobConfig implements BatchConfigurer {
		SimpleJobOperator jobOperator = new SimpleJobOperator();
		jobOperator.setJobExplorer(getJobExplorer());
		jobOperator.setJobLauncher(getJobLauncher());
		jobOperator.setJobRegistry(jobRegistry());
		jobOperator.setJobRegistry(jobRegistry);
		jobOperator.setJobRepository(getJobRepository());
		jobOperator.afterPropertiesSet();

@@ -82,7 +78,7 @@ public class JobConfig implements BatchConfigurer {
	@Bean
	public JobRegistryBeanPostProcessor jobRegistryBeanPostProcessor() throws Exception {
		JobRegistryBeanPostProcessor jobRegistryBeanPostProcessor = new JobRegistryBeanPostProcessor();
		jobRegistryBeanPostProcessor.setJobRegistry(jobRegistry());
		jobRegistryBeanPostProcessor.setJobRegistry(jobRegistry);
		jobRegistryBeanPostProcessor.afterPropertiesSet();

		return jobRegistryBeanPostProcessor;
+3 −2
Original line number Diff line number Diff line
@@ -6,7 +6,6 @@ import org.joda.time.DateTime;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

import com.vividsolutions.jts.geom.LineString;
import com.vividsolutions.jts.geom.MultiLineString;
@@ -31,7 +30,6 @@ import ma.glasnost.orika.impl.ConfigurableMapper;
import ma.glasnost.orika.impl.DefaultMapperFactory;
import ma.glasnost.orika.metadata.TypeFactory;

@Component
public class OrikaScanBean extends ConfigurableMapper
		implements ApplicationContextAware, OrikaScanBeanESItfc, OrikaScanBeanDBItfc {

@@ -81,6 +79,7 @@ public class OrikaScanBean extends ConfigurableMapper
	 * @param applicationContext
	 *            The application context to look for managed beans in.
	 */
	@Override
	public void addAllSpringBeans() {
		@SuppressWarnings("rawtypes")
		final Map<String, Converter> converters = applicationContext.getBeansOfType(Converter.class);
@@ -105,6 +104,7 @@ public class OrikaScanBean extends ConfigurableMapper
	 * @param converter
	 *            The converter.
	 */
	@Override
	public void addConverter(final Converter<?, ?> converter) {
		factory.getConverterFactory().registerConverter(converter);
	}
@@ -115,6 +115,7 @@ public class OrikaScanBean extends ConfigurableMapper
	 * @param mapper
	 *            The mapper.
	 */
	@Override
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public void addMapper(final CustomMapper<?, ?> mapper) {

+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ dataSession.enabled=true
#api
server.port=8088
server.servlet.context-path=/api
server.servlet.path=/tasks
spring.mvc.servlet.path=/tasks

spring.profiles.active=@spring.profiles.active@

+4 −3
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ import org.apache.commons.logging.LogFactory;
import org.junit.ClassRule;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.kafka.test.rule.KafkaEmbedded;
import org.springframework.kafka.test.rule.EmbeddedKafkaRule;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ActiveProfiles;
@@ -38,12 +38,13 @@ public abstract class IntegrationTestBase extends KafkaBaseIntegrationTest {
	// En este contexto es necesario definir embeddedKafka para que la
	// configuración se pueda completar
	@ClassRule
	public static KafkaEmbedded embeddedKafka = new KafkaEmbedded(1);
	public static EmbeddedKafkaRule embeddedKafka = new EmbeddedKafkaRule(1);

	@PostConstruct
	public void IntegrationTestBasePostConstruct() throws Exception {

		createSchemaRegistryRestApp(embeddedKafka.getZookeeperConnectionString(), embeddedKafka.getBrokersAsString());
		createSchemaRegistryRestApp(embeddedKafka.getEmbeddedKafka().getZookeeperConnectionString(),
				embeddedKafka.getEmbeddedKafka().getBrokersAsString());
	}

	@Autowired
Loading