I am new to use Dynamo DB,
I want to know how to setup pom.xml like if I use maven what is dependency use for dynamodb
<dependencies>
<dependency>
<groupId>??</groupId>
<artifactId>??</artifactId>
<version>??</version>
<scope>test</scope>
</dependency>
<dependency>
or any example source code which I can research how to use it?
For dynamodb and how to setup like list of table and create column one by one in dynamodb any source can i read ?
if you want to use aws dynamo DB so you can use following code:
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-dynamodb</artifactId>
<version>1.11.784</version>
</dependency>
you can use following example for setup by using below link
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/CodeSamples.Java.html
Dependency in pom is:
<dependency>
<groupId>com.github.derjust</groupId>
<artifactId>spring-data-dynamodb</artifactId>
<version>5.1.0</version>
</dependency>
Next if You want to use it in code You need to read about #DynamoDBTable .
Best lecture about it have of course Baeldung
Related
I'm struggling with Twitter4j. I am using a Maven project with the following Twitter4j dependency:
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-core</artifactId>
<version>[4.0,)</version>
</dependency>
However every time I try and declare a StatusListener, I get Cannot resolve symbol 'StatusListener' even though I'm importing import twitter4j.*;.
Anyone know why this might happen when I can use pretty much all other features of Twitter4j?
I needed to add
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-stream</artifactId>
<version>[4.0,)</version>
</dependency>
As a dependency to my pom.xml. Turns out the Streaming API and all related classes are in a different part of the Twitter4J ecosystem.
As twitter4j lib contains the core, async, example, and a stream part. You should try to include all these but mainly the stream dependency contains the status listener method. I hope it solves your problem.
Intent : I am working on a POC which intends to use AWS Parameter store as a property store.This would store the confidential application properties in AWS SSM's Parameter store.I am using Java 8 with spring boot/cloud version 2.
Resource : I followed this ref guide from spring docs
and
also a comprehensive article Integrating the AWS Parameter Store with Spring Cloud .Hence was trying to utilize
spring-cloud-starter-aws-parameter-store-config.jar
and hence added required dependency in the build file.
Expected output :
Actual output :
Here is snapshot from AWS console I am trying to access below shown parameters from AWS parameter store
Below are my spring property files:
application.yml
bootstrap.yml
I am using maven with below dependencies in POM.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.1.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-aws-parameter-store-config</artifactId>
</dependency>
</dependencies>
Am I missing something here?? Please let me know if someone has already faced and resolved this issue.
I am able to put and get parameter from command line,its just not able to get this java lib working.
GitHub repo of the sample I am trying -
GitHub repo link
I checked your app, it didn't work as expected for me as I had ~.aws/config file which leads to misconfiguration of AWS credentials(cause by DefaultAWSCredentialsProviderChain, read more here ), so I removed it, and I tried again but it fails saying that spring can't find aws region in the env, so apparently those specified in application.yml won't be used until spring loads properties from AWS parameter store.
How I made it work
I added:
System.setProperty("aws.accessKeyId","My_Key");
System.setProperty("aws.secretKey","Secret");
System.setProperty("aws.region","us-east-1");//same region where all your params exist
before SpringApplication.run(DemoApplication.class, args); and then it worked.
when changing the aws.region to another one where there are no params value defined I got the exact same result as yours (empty values).
make sure there isn't any aws config on your machine or EC2 instance that will override those provided in your app.
According to the GraphiQL README I can customize the interface by adding React children like this:
<GraphiQL.Logo>
My Custom Logo
</GraphiQL.Logo>
That is great, but how do I actually set these children? I'm not a web developer and I've never used React before! I'm developing a Spring-Boot project with the following dependencies:
<dependency>
<groupId>com.graphql-java-kickstart</groupId>
<artifactId>graphql-spring-boot-starter</artifactId>
<version>5.0.6</version>
</dependency>
<dependency>
<groupId>com.graphql-java-kickstart</groupId>
<artifactId>graphiql-spring-boot-starter</artifactId>
<version>5.0.6</version>
</dependency>
I don't see any way to set the children via application.properties/yml, although I can set other things there like the pageTitle, defaultQuery and editorTheme.
I can override the graphiql.html page provided by the starter. I naively tried to set the children like this at the end of the page:
// Render <GraphiQL /> into the body.
ReactDOM.render(
React.createElement(GraphiQL, props, [React.createElement('GraphiQL.Logo', {}, 'Custom LOGO')]),
document.body
);
That didn't have any effect.
How should I approach this?
i have a java application in which i want to programmatically add URL parameters to a given base url, instead of string manipulation to form a url. i have heard that URIBuilder is the way to go, though I have not been able to get that class or the maven repository to that class anywhere? is that the way to go or is there any other method to get that done?
EDIT: i have heard of using apache http client utils URIBuilder and not the javax.ws URIBuilder class
Drop this dependency in your pom to get UriBuilder:
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version><!-- Select the version you want here -->
</dependency>
More info: http://mvnrepository.com/artifact/javax.ws.rs/jsr311-api
The Apache version is part of the httpcomponents:
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.1</version>
</dependency>
More info: http://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient/
You can use java.net.URL to create a URL. The set() method allows you to set query parameters.
Doing my first steps with kafka (java code) I would like to create a simple test for kafka producer, something like this where I can mock zoo keeper (this implementation looks nice but I can't reach some of the classes there, specifically EmbeddedZookeeper and TestUtils).
Any ideas?
You can use the Kafka-test artifact:
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.9.2</artifactId>
<version>0.8.0</version>
<classifier>test</classifier>
<scope>test</scope>
</dependency>
If you need a separate mock for zookeeper, Apache curator-test might do:
<dependency>
<groupId>org.apache.curator</groupId>
<version>2.3.2-SNAPSHOT</version>
<artifactId>curator-test</artifactId>
<scope>test</scope>
</dependency>
Probably taken from the Kafka source ..
Check here for EmbeddedZk and here for the Utils ..
The full package is available here
see if it helps