spring-boot

How to group properties with Spring Boot Configuration Properties

非 Y 不嫁゛ 提交于 2021-02-19 06:45:19
问题 According to Spring Boot documentation, properties can be grouped and a property may appear in more than one group. But at the moment when we create a property class marked with @ConfigurationProperties(prefix="test1") the group name will be the prefix which is test1. Now if I have another property class for example with prefix as "test2" how can I say this latter one has a property from the group test1? --- UPDATE --- Added nested class but it's not working @Configuration @Profile({"wmx"})

Spring Batch - How to read from One Table and Write Data into two different table

有些话、适合烂在心里 提交于 2021-02-19 06:10:54
问题 I'm using Spring Boot and Spring Batch to read data from One table of source database table and split the data and write it into two tables of target database. I choose to use CompositeItemWriter for this, but CompositeItemWriter<?> only one type. I want to write few fields in one table and other fields into another table. Say: OLD Customer and NEW Customer. Error: The constructor CustomerClassifier(JdbcBatchItemWriter, JdbcBatchItemWriter) is undefined ClassifierCompositeItemApplication.java

How to debug a Spring Boot application in Spring Tool Suite

落爺英雄遲暮 提交于 2021-02-19 04:35:08
问题 I'd like to debug a simple Spring Boot application in Spring Tool Suite. It is a simple restful web service. I wanted to debug the controller and service class with embedded tomcat server. Found this post how to debug Spring MVC application on Spring Source Tool Suite. I followed the steps: Select Window-->Show View--> Servers . Right Click on server in the Servers panel, select " Debug ". Add breakpoints in your code Then right click on application, Select Debug As --> Debug on Server After

Error using XStream in Spring context: DuplicateFieldException

心不动则不痛 提交于 2021-02-19 04:28:12
问题 I've a problem using XStream in Spring context. The method c.t.x.XStream.addImplicitCollection(Class ownerType, String fieldName, String itemFieldName, Class itemType) doesn't work correctly if we import the xstream dependency in pom but it does work if we import xstream source code and we esclude related dependency in pom. We used the following dependencies' version: xstream : 1.4.11.1 spring-boot-dependencies : 2.1.2.RELEASE Testing fromXml with the xstream's dependency in the pom.xml we

When should I use TypeExcludeFilters in Spring?

纵饮孤独 提交于 2021-02-19 03:36:30
问题 Recently, Spring Boot added TypeExcludeFilters. One prominent use case is the SpringBootApplication annotation. Before Spring Boot 1.4: // ... @ComponentScan public @interface SpringBootApplication { // ... Since Spring Boot 1.4: // ... @ComponentScan(excludeFilters = @Filter(type = FilterType.CUSTOM, classes = TypeExcludeFilter.class)) public @interface SpringBootApplication { // ... The main motivation seems to improve testing support in Spring, but I fail to get an intuitive understanding

Spring Boot doesn't use CommonsMultipartResolver?

吃可爱长大的小学妹 提交于 2021-02-19 03:36:07
问题 I have a problem with REST web service running with Spring Boot (Jetty). One of my REST method is file upload and I'm guessing that CommonsMultipartResolver is not using during multipart requests. Signature of this upload method is : @ResponseBody @RequestMapping(value = "/upload", method = RequestMethod.POST, produces = "application/json") public BaseResponse upload(@RequestParam("login") String login, @RequestParam("passwd") String passwd, @RequestParam("partner") String partner,

Spring Boot doesn't use CommonsMultipartResolver?

纵然是瞬间 提交于 2021-02-19 03:36:06
问题 I have a problem with REST web service running with Spring Boot (Jetty). One of my REST method is file upload and I'm guessing that CommonsMultipartResolver is not using during multipart requests. Signature of this upload method is : @ResponseBody @RequestMapping(value = "/upload", method = RequestMethod.POST, produces = "application/json") public BaseResponse upload(@RequestParam("login") String login, @RequestParam("passwd") String passwd, @RequestParam("partner") String partner,

When should I use TypeExcludeFilters in Spring?

家住魔仙堡 提交于 2021-02-19 03:36:03
问题 Recently, Spring Boot added TypeExcludeFilters. One prominent use case is the SpringBootApplication annotation. Before Spring Boot 1.4: // ... @ComponentScan public @interface SpringBootApplication { // ... Since Spring Boot 1.4: // ... @ComponentScan(excludeFilters = @Filter(type = FilterType.CUSTOM, classes = TypeExcludeFilter.class)) public @interface SpringBootApplication { // ... The main motivation seems to improve testing support in Spring, but I fail to get an intuitive understanding

Spring Boot JacksonTester custom serializer not registered

送分小仙女□ 提交于 2021-02-19 03:35:18
问题 Trying to run the through Jackson library for some upcoming work. I've got the following test model: Address.java package com.example.domain; import java.time.LocalDate; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind

Connect to MSSQL from Spring boot application using windows authentication

孤街醉人 提交于 2021-02-19 02:22:28
问题 I am currently using the below properties to connect to a remotely Mssql server from Java spring boot application: spring.datasource.url=jdbc:sqlserver://ip\\domain;databaseName=name spring.datasource.username=abc spring.datasource.password=def spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver The application runs from both windows and unix servers. I need now to start using the windows authentication instead of the db credentials. This is already configured and