Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 07:31
    wilkinsona assigned #31577
  • 07:12
    wilkinsona unlabeled #31572
  • 07:12
    wilkinsona labeled #31572
  • 07:12
    wilkinsona commented #31572
  • Jul 05 21:39
    spring-projects-issues labeled #31577
  • Jul 05 21:34
    springframeworkguru opened #31577
  • Jul 05 20:22
    musindo commented #5510
  • Jul 05 19:16
    jakubskalak commented #31516
  • Jul 05 19:09
    wilkinsona unlabeled #31570
  • Jul 05 19:09
    wilkinsona labeled #31570
  • Jul 05 19:08
    wilkinsona commented #31516
  • Jul 05 18:44
    spring-projects-issues unlabeled #31570
  • Jul 05 18:44
    spring-projects-issues labeled #31570
  • Jul 05 18:43
    johnchurchill commented #31570
  • Jul 05 17:31
    wilkinsona labeled #31570
  • Jul 05 17:31
    wilkinsona labeled #31570
  • Jul 05 17:31
    wilkinsona unlabeled #31570
  • Jul 05 17:31
    wilkinsona commented #31570
  • Jul 05 17:23
    wilkinsona reopened #31570
  • Jul 05 17:23
    wilkinsona commented #31570
Jacob Kristhammar
@jacobk
Since i'm slightly confused about which annotations spring will "detect" . I've only ever used out of the box @ComponentScan and probably have some reading to do in order to understand how that works with with e.g. a starter.
Like, factories points out which configuration classes to run -> boot finds those configurations and "does something" which I don't have a good mental model of, e.g. process @Configuration, @Bean etc. It's all a bit magic to me still ;)
Thanks for the guidance, i will try that out.
Stéphane Nicoll
@snicoll
There was quite some refactoring of the doc in the 2.2 line I am afraid
Toon Geens
@tgeens
Thanks
tell google :-)
Stéphane Nicoll
@snicoll
gah
I’ll call them right away :)
James Howe
@OrangeDog
could possibly put some easy redirects in, depend how your site works
James Howe
@OrangeDog
James Howe
@OrangeDog

Are there more details on this?

Support for Spring Session’s flush mode.

Matthew Planchant
@mplanchant
Upgrading to 2.2.0, how do users of spring-security-oauth2-boot (https://github.com/spring-projects/spring-security-oauth2-boot) deal with the removal of @WebMvcTest(controllers = MyControllerImpl.class, secure = false) (https://github.com/spring-projects/spring-boot/issues/14227)? There is no @WithMockUser.
James Howe
@OrangeDog
@mplanchant not sure what the problem is. I'm such a user and never used secure=false. I either have the SAML config excluded, or use the SecurityMockMvcRequestPostProcessors
Stéphane Nicoll
@snicoll
There is no @WithMockUser.
It’s in spring-security-test perhaps you don’t have that test util in your project?
Matthew Planchant
@mplanchant

I'm using spring-security-oauth2-autoconfigure to make use of the OAuth2RestTemplate. I have the autoconfgured web security disabled:

@Configuration
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
    @Override
    protected void configure(AuthenticationManagerBuilder auth) {
        // No configuration disables security
    }

    @Override
    protected void configure(HttpSecurity http) {
        // No configuration disables security
    }
}

But I needed to use secure = false for my MockMvc controller tests.

Alex Vinnik
@crawlik
iI have a guice project and I want to use spring data with all its coolness. Came across https://github.com/spring-projects/spring-guice. Any good example how to wire spring data in that guice app?
James Howe
@OrangeDog

No configuration disables security

Not if you don't call super(true)

Adriansun
@Adriansun
Hello, do we have some Spring boot experts here?
I have a question about Swagger 2.9.2 and Spring Boot 2.2.0.
Adriansun
@Adriansun
Anyone here?
José Marques
@jnmarques

Hi guys, I'm trying to fetch a list of Entity that have some relations with lazy loading. When I try to use the relations I get the session closed error. What am I doing wrong?
My Entity:

@Entity
@Table(name="obj1")
public class Obj1 {

    // Properties

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name="id")
    private int id;

    // Relationships

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "idobj2")
    private Obj2 obj2;

    // Constructors

    public SmsMt() {
    }


    // Getter/Setters
    ...

    // toString
    @Override
    public String toString() {
        String obj_format = "id: %d, obj2.id: %d";

        return String.format(
                obj_format,
                getId(),
                getObj2().getId());

    }
}

the JPARepository:

public interface Obj1Repository extends JpaRepository<Obj1, Integer> {
}

The method where I access it:

@Component
public class Obj1Reader implements ItemReader<Obj1> {

    private static final Logger log = LoggerFactory.getLogger(Obj1.class);


    @Autowired
    private Obj1Repository obj1Repository;

    private int nextIndex;
    private List<Obj1> obj1s;

    @PostConstruct
    private void initialize() {
        obj1s = obj1Repository.findAll();
        nextIndex = 0;
        for(Obj1 obj : obj1s){
            log.info("Found Obj: " + obj);
        }
    }

    @Override
    public SmsMt read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException {
      ...
    }
}

And it throws an error in "Found Obj:" + obj because the toString tries to access the lazyLoading object
How do I keep the session open after I fetch the list?
the open in view configuration doesn't seem to help

Cassius Vinicius
@cviniciusm_gitlab

@konstantinblaesi and @wilkinsona I have similar issue regarding deserialization of a json string with a key/value timestamp "sometimestamp": "2019-10-17T17:45:50" (ISO 8601 date and time representation) to a pojo with attribute/field/property LocalDateTime sometimestamp;

But I did do another project to test/verify/confirm the issue but it not happened, so there is some bug on my project that mess jackson deserialization.

Please, see those simple projects: https://gitlab.com/javatimegroup

Cassius Vinicius
@cviniciusm_gitlab
I mean "sometimestamp": "2019-10-17T17:45:50.342"
Caleb Cushing
@xenoterracide
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fhirProperties': @EnableConfigurationProperties or @ConfigurationPropertiesScan must be used to add @ConstructorBinding type com.potreromed.phg.emr.fhir.FhirProperties
the class in question
package com.potreromed.phg.emr.fhir;

import ca.uhn.fhir.context.FhirVersionEnum;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.ConstructorBinding;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
@ConstructorBinding
@EnableConfigurationProperties
@ConfigurationProperties( "fhir" )
public class FhirProperties {

    private final FhirVersionEnum version;
    private final String endpoint;
    private final SystemCodes system;

    FhirProperties( FhirVersionEnum version, String endpoint, SystemCodes system ) {
        this.version = version;
        this.endpoint = endpoint;
        this.system = system;
    }

    public FhirVersionEnum getVersion() {
        return version;
    }

    public String getEndpoint() {
        return endpoint;
    }

    public SystemCodes getSystem() {
        return system;
    }

    public static class SystemCodes {
        private final String bodyweight;
        private final String identifier;

        public SystemCodes( String bodyweight, String identifier ) {
            this.bodyweight = bodyweight;
            this.identifier = identifier;
        }

        public String getBodyweight() {
            return bodyweight;
        }

        public String getIdentifier() {
            return identifier;
        }
    }
}
what am I doing wrong?
Cassius Vinicius
@cviniciusm_gitlab
@xenoterracide try with "@ConfigurationProperties( "fhir" )" only.
SANJOY GANGULY
@sanngly
spring-cloud-starter-netflix-eureka-client did not register to spring-cloud-starter-netflix-eureka-server I am not able to view in http://localhost:8761 anyone having anyidea
Shradha Bharti
@bharti.shradha_gitlab
@sanngly : have u provided the properties
eureka.client.registerWithEureka=true
eureka.client.fetchRegistry=true
even the url eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka/
because it working perfectly
SANJOY GANGULY
@sanngly
@bharti.shradha_gitlab Thanks !! let me try
Shradha Bharti
@bharti.shradha_gitlab
ok
Matthew Planchant
@mplanchant
@OrangeDog Thanks!
Stéphane Nicoll
@snicoll
@xenoterracide there’s no need to add @EnableConfigurationProperties. Never was necessary when you use classpath scanning. In 2.2 we scan such type automatically so remove @Component as well
Luiz Aguiar
@aguiarluiz

Hey folks... before the RC1 release, I was using my properties without @ConstructorBinding. I followed the new documentation, added the annotation to see and it works.

@Configuration
@EnableConfigurationProperties(
    MyProperties1::class,
    MyProperties2::class
)
class PropertiesConfiguration

@ConstructorBinding
@ConfigurationProperties("app.props1")
data class MyProperties1(
    val field: String
)

@ConstructorBinding
@ConfigurationProperties("app.props2")
data class MyProperties2(
    val field: String
)

I just want to confirm if this is the expected way to declare the properties on 2.2.x or may I doing something else and don't even need to use @ConstructorBinding here?

Stéphane Nicoll
@snicoll
Sounds about right
You don’t need the @EnableConfigurationProperties if that package is scanned by your app (unrelated but 2.2 scans config props)
Luiz Aguiar
@aguiarluiz
@snicoll thanks :thumbsup:
Jorg Heymans
@jorgheymans
When using TransactionSynchronizationManager.registerSynchronization and the primary transaction manager is ChainedKafkaTransactionManager, the synchronization will by default fail because KafkaTransactionManager has synchronization disabled. Fair enough, i can enable it. But really what i would like to do is a way to register the Synchronization with the outermost DataSourceTransactionManager that is also active, it seems that synchronizations are registered with the innermost TM automatically.
Jorg Heymans
@jorgheymans
^^^ above assumes ChainedTransactionManager is created with (datasourceTxMgr, kafkaTxMgr) in that order
From KafkaTransactionManager
     * Transaction synchronization is turned off by default, as this manager might be used alongside a datastore-based
     * Spring transaction manager like DataSourceTransactionManager, which has stronger needs for synchronization. Only
     * one manager is allowed to drive synchronization at any point of time.
Konstantin Bläsi
@konstantinblaesi
I have FooClient class implementing communication with a REST API , tested in FooClientTest which is annotated with @RestClientTest({FooAPIClient.class, FooAPIConnection.class, FooAPIProperties.class, FooAPIAutoConfiguration.class})
My problem is that spring fails to inject properties in FooAPIProperties.class that are annotated with @Value(...) . Any tips what I need to change to make spring inject these values from the properties file?
Jieran.Peng
@pengjieran
perhaps you can check your scan package path or propertie name
SANJOY GANGULY
@sanngly
@sanngly Hi I facing same eureka client not showing in http://localhost:8761/eureka/
@bharti.shradha_gitlab I am facing same issue eureka client is not connecting and showing in http://localhost:8761/eureka/
Rakesh
@ravening
is EmbeddedServletContainerFactory method supported in spring boot 2.1.4-release? Im trying to add ssl support for spring boot app but cant create the beans as this method is not found.
Omid Dehghan
@odchan1_twitter

Hi, I'm trying to send and get cookies to my browser. Sending cookies works just fine, but when I tried to get those cookies back, the path and age are turning to null , -1 But I can see in the browser that these cookies actually have path and expire date!
So does anyone knows why this is happening?
Here is how I did it:

 @GetMapping("/home")
    public void homePage(HttpServletRequest request, HttpServletResponse response){
        System.out.println("A request comes in");

        HttpServletResponse httpServletResponse = response;
        HttpServletRequest httpServletRequest = request;

        Cookie cookie= new Cookie("C10","this-is-the-value-of-the-cookie");
        cookie.setPath("/");
        cookie.setMaxAge(86400);

        httpServletResponse.addCookie(cookie);

        if(httpServletRequest !=null){
            Cookie[] cookies = httpServletRequest.getCookies();
            for (Cookie cookie1: cookies){
                System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"+cookie1.getName()+ " and the path of this cookie is: "
                        + cookie1.getPath()+ " Expire date: "+ cookie1.getMaxAge()+" Value of the cookie: "+cookie1.getValue());
            }
        }

Ant the output:

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Key5002 and the path of this cookie is: null Expire date: -1 Value of the cookie: Value5002
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Key6001 and the path of this cookie is: null Expire date: -1 Value of the cookie: Value6001
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Key6002 and the path of this cookie is: null Expire date: -1 Value of the cookie: Value6002
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Key7001 and the path of this cookie is: null Expire date: -1 Value of the cookie: Value7001
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Key7002 and the path of this cookie is: null Expire date: -1 Value of the cookie: Value7002
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Key70001 and the path of this cookie is: null Expire date: -1 Value of the cookie: Value70001
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Key70002 and the path of this cookie is: null Expire date: -1 Value of the cookie: Value70002
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Key5001 and the path of this cookie is: null Expire date: -1 Value of the cookie: Value5001
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^JSESSIONID and the path of this cookie is: null Expire date: -1 Value of the cookie: BFF2E7B669508E8C89B3D472F18C4665
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^cookie2 and the path of this cookie is: null Expire date: -1 Value of the cookie: this-is-the-value-of-the-cookie
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^C10 and the path of this cookie is: null Expire date: -1 Value of the cookie: this-is-the-value-of-the-cookie