Apache camel with Spring DSL marshal to json issue

I have the following config<dataFormats> <json id="orderModel" library="Jackson" objectMapper="com.camel.CustomObjectMapper" unmarshalTypeName="com.orders.OrderModel"/> <json id="salesOrder" library="Jackson" objectMapper="com.camel.CustomObjectMapper" unmarshalTypeName="com.camel.model.salesorder.SalesOrder"/></dataFormats><route id="orderTranslateToSalesOrder"> <from ref="orderPlaced"/> <unmarshal ref="orderModel" /> <process ref="custome...Read more

logging - Spring Boot log file not being created

I have a spring boot app (1.5.10.RELEASE) that logs great when running as a standalone application in Eclipse IDE. I am using spring config and the properties file says this:logging.level.com.myco.impl=DEBUGlogging.path=/log/myServiceWhen I run as a standalone application, I see everything I see logged to the console and to a file in the above directory (called spring.log). I then build my "uber jar" and run in like this:java -jar my-service-0.1.0.jar. I see all the console logging just like running in IDE. I can see it looking for my confi...Read more

HTTP and HTTPS with keycloack + spring

I am trying to secure my application using keycloak. I use angular for my frontend and spring boot for my backend. Using only http, everything works fine, the problem is, if I want to use HTTPS along side HTTP, I am having a problem with the backend throwing an error like:o.k.a.BearerTokenRequestAuthenticator : Failed to verify tokenorg.keycloak.common.VerificationException: Invalid token issuer. Expected 'http://myDomain/auth/realms/realmName', but was 'https://myDomain/auth/realms/realmName'in my properties file I do have the: keycloak.auth-s...Read more

spring boot - @WebMvcTest for SOAP?

Is the Spring Boot annotation @WebMvcTest only intended for sliced RestController tests or should SOAP Endpoints be testable with it too? When I setup my test and run it, I only get a 404 response as if the endpoint wasn't there so I assume it isn't part of the WebMvc slice. @RunWith(SpringRunner.class)@WebMvcTest(value = IdServerPortTypeV10.class)@Import({SecurityConfig.class, ModelMapperConfig.class, WebServiceConfig.class, ControllerTestBeans.class})public class AccountEndpointTests { @Autowired IdServerPortTypeV10 soapEndpoint; ......Read more

Do not want to load application.yml when testing with Spring Boot

How can I tell Spring to load only application-test.yml and not application.yml file ?I have a config class:@ActiveProfiles("test")@SpringBootConfigurationpublic class MongoTestConfig { @Autowired MongoOperations operations;...}And a test class:@RunWith(SpringRunner.class)@DataMongoTest@SpringBootTest(classes = MongoTestConfig.class)public class TagDefinitionRepositoryTest {...@Test....}I've tried to add :@TestPropertySource(locations = {"classpath:application-test.yml"})@ContextConfiguration(initializers = ConfigFileApplicationContextIni...Read more

spring boot - Mock the dependent microservices for testing the performance of another microservice

I am working on setting up the environment for testing the performance of a microservice A.This microservice A has dependency to another micro service B.Both the microservices are registered in JHipster Registry and Rippon client is used for communicating between microservices(A & B).How do I mock the dependent micro service so that I don't need to hit that real microservice B?...Read more

Spring cloud Zuul and JWT refresh token

I have a local orchestrated environment using spring cloud components (eureka, zuul, and an auth servers). These components are all implemented as separate standalone services. I then have a growing number of combined UI/resource services where the individual services all have their own UI. The UI is put together server side using thymeleaf templates but are essentially angularjs single page apps that run in the browser.A single Zuul service fronts all the ui/resource services. I have annotated all the ui/resource services @EnableResourceSe...Read more

spring boot - Howto bind SpringBoot with SpringData to Elasticsearch in CloudFoundry?

When starting Elasticsearch locally on my development machine I can connect from SpringBoot to Elasticsearch and my JUnit testcases works.But when I try to connect to Cloud Foundry Elasticsearch it does not work.Starting on command line, i.e. redirecting port 9300 to Cloud Foundry:cf ssh -N -L 9300:8twkrqe7blbjoi28.service.consul:47289 my-proxyI use the same port and configuration in SpringBoot for both local Elasticsearch and with Cloud Foundry Elasticsearch:public class ElasticsearchConfiguration {@Beanpublic Client client() throws Exception ...Read more

spring boot - Springboot application in pivotal Cloud with different environments

I am using a Pivotal Cloud foundry with different testing environments (test, QA, UAT, PROD) Spring boot applicationI have created multiple properties files(Each pointing to different db) likeapplication-dev.propertiesapplication-test.propertiesapplication-qa.propertiesapplication-uat.propertiesapplication-prod.propertiesif it is in local i am running by seting -Dspring.progiles.active=test/qa/uat/prod mvn clean compile springboot:run -Dspring.progiles.active=testHow can i make it customize my application to use the specific properties file bas...Read more

spring boot - Unable to map the error getting from the application deployed using lambda function

I am having springboot application deployed using a lambda function. Please find the below sample.Controller@RequestMapping(method = RequestMethod.GET, value = "/bugnlow/findByRegionId/{regionId}", produces = "application/json")public ResponseEntity<List<Bunglow>> findAllBunglowsByRegionId(@PathVariable int regionId, @RequestParam int page, @RequestParam int size) {Page<Bunglow> bunglows = bunglowsService.findAllBunglowsByRegionId(regionId, page, size);if (bunglows.getContent().size() == 0){ return ResponseEntity.notFound()...Read more

spring boot - How to listen to entity creation when invoked programmatically?

I have a (simplified below) RestController invoking a CrudRepository.@RestController@RequestMapping({"/carApi"})public class RestService { @Autowired private StorageService storageService; @PostMapping public RightTriangle create(@RequestBody DegregatedCar degregatedCar) { // Some logic Car car = convert(degregatedCar); return storageService.save(car); }}public interface StorageService extends CrudRepository<Car, Long> {}I'd like to do some additional stuff after the entity (car in this case) is saved.I...Read more

jax rs - Spring Cloud - HystrixCommand - How to properly enable with shared libraries

Using Springboot 1.5.x, Spring Cloud, and JAX-RS:I could use a second pair of eyes since it is not clear to me whether the Spring configured, Javanica HystrixCommand works for all use cases or whether I may have an error in my code. Below is an approximation of what I'm doing, the code below will not actually compile. From below WebService lives in a library with separate package path to the main application(s). Meanwhile MyWebService lives in the application that is in the same context path as the Springboot application. Also MyWebService ...Read more

spring boot - apache camel http4 error handling

I have a weird issue that happened after upgrading from Camel 2.17 to 2.18. In my router class, I have the following snippet to process incoming requests. Good requests get passed down the chain, while specific errors get targeted for error handling like so:application.ymlcamel.endpoint.my.servletEndpoint: servlet:///activate?httpMethodRestrict=POST,OPTIONSCamelRouter.javafrom("{{camel.endpoint.my.servletEndpoint}}") .doTry() .process(myRequestProcessor) .to("{{camel.endpoint.my.trigger}}") ....Read more