Aws-cdk: Stack defined in Java init template doesn't take props

Created on 22 Nov 2019  路  3Comments  路  Source: aws/aws-cdk

The stack defined in the Java init template doesn't accept a props argument, making the user revise their constructor if they want to be able to pass in, say, an environment.

I'd suggest providing two constructors, one with props and one without, to match the behavior in other init templates. To wit:

public class JavaJiveStack extends Stack {
    public JavaJiveStack(final Construct scope, final String id) {
        this(scope, id, null);
    }

    public JavajiveStack(final Construct scope, final String id, StackProps props) {
        super(scope, id, props);

        // The code that defines your stack goes here
    }
}

You'll also need an import for StackProps now.


This is :bug: Bug Report

bug languagjava packagtools

Most helpful comment

In fact this was already updated, but the new templates haven't been released just yet.

All 3 comments

@Jerry-AWS thanks for reporting, will take a look at this one

In fact this was already updated, but the new templates haven't been released just yet.

Closing this issue since the fix has already been implemented and is just waiting to be released.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eladb picture eladb  路  3Comments

nzspambot picture nzspambot  路  3Comments

pepastach picture pepastach  路  3Comments

abelmokadem picture abelmokadem  路  3Comments

eladb picture eladb  路  3Comments