Skip to content

Commit 13d2d94

Browse files
author
Mike Kistler
authored
Merge pull request #1 from watson-developer-cloud/mdk/watson-spring-boot
Initial attempt at Watson Spring support
2 parents 054480c + ac4b621 commit 13d2d94

39 files changed

+2120
-4
lines changed

.github/CODE_OF_CONDUCT.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
## Our Standards
8+
9+
Examples of behavior that contributes to creating a positive environment include:
10+
11+
* Using welcoming and inclusive language
12+
* Being respectful of differing viewpoints and experiences
13+
* Gracefully accepting constructive criticism
14+
* Focusing on what is best for the community
15+
* Showing empathy towards other community members
16+
17+
Examples of unacceptable behavior by participants include:
18+
19+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
20+
* Trolling, insulting/derogatory comments, and personal or political attacks
21+
* Public or private harassment
22+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
23+
* Other conduct which could reasonably be considered inappropriate in a professional setting
24+
25+
## Our Responsibilities
26+
27+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28+
29+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30+
31+
## Scope
32+
33+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34+
35+
## Enforcement
36+
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38+
39+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40+
41+
## Attribution
42+
43+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44+
45+
[homepage]: http://contributor-covenant.org
46+
[version]: http://contributor-covenant.org/version/1/4/

.github/CONTRIBUTING.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Questions
2+
3+
If you are having difficulties using the APIs or have a question about the IBM Watson Services,
4+
please ask a question on [dW Answers][dw] or [Stack Overflow][stackoverflow].
5+
6+
# Issues
7+
8+
If you encounter an issue with the Watson Spring Boot support, you are welcome to submit a
9+
[bug report](https://github.com/watson-developer-cloud/watson-spring/issues).
10+
Before that, please search for similar issues. It's possible somebody has encountered this issue already.
11+
12+
# Pull Requests
13+
14+
If you want to contribute to the repository, here's a quick guide:
15+
1. Fork the repository
16+
1. Create a `.config.properties` similar to [`config.properties`](https://github.com/watson-developer-cloud/java-sdk/blob/master/core/src/test/resources/config.properties).
17+
2. develop and test your code changes, gradle: `gradle test`.
18+
* Run `checkstyle`: `gradle checkstyle`. 🏁
19+
* Create minimal diffs - disable on save actions like reformat source code or organize imports. If you feel the source code should be reformatted create a separate PR for this change.
20+
* Check for unnecessary whitespace with git diff --check before committing.
21+
3. Make the test pass
22+
4. Commit your changes:
23+
* Use the present tense (`"Add feature"` not `"Added Feature"`)
24+
* Use the imperative mood (`"Move cursor to…"` not `"Moves cursor to…"`)
25+
* Include relevant Emoji from our [Emoji cheatsheet](#emoji-cheatsheet)
26+
5. Push to your fork and submit a pull request to the **master** branch
27+
28+
# Developer's Certificate of Origin 1.1
29+
30+
By making a contribution to this project, I certify that:
31+
32+
(a) The contribution was created in whole or in part by me and I
33+
have the right to submit it under the open source license
34+
indicated in the file; or
35+
36+
(b) The contribution is based upon previous work that, to the best
37+
of my knowledge, is covered under an appropriate open source
38+
license and I have the right under that license to submit that
39+
work with modifications, whether created in whole or in part
40+
by me, under the same open source license (unless I am
41+
permitted to submit under a different license), as indicated
42+
in the file; or
43+
44+
(c) The contribution was provided directly to me by some other
45+
person who certified (a), (b) or (c) and I have not modified
46+
it.
47+
48+
(d) I understand and agree that this project and the contribution
49+
are public and that a record of the contribution (including all
50+
personal information I submit with it, including my sign-off) is
51+
maintained indefinitely and may be redistributed consistent with
52+
this project or the open source license(s) involved.
53+
54+
## Emoji Cheatsheet
55+
56+
When creating creating commits or updating the `CHANGELOG`, please **start** the commit message or update with one of the following applicable Emoji. Emoji should not be used at the start of issue or pull request titles.
57+
58+
* :new: `:new:` when adding new functionality
59+
* :bug: `:bug:` when fixing a bug
60+
* :memo: `:memo:` when writing documentation
61+
* :art: `:art:` when improving the format/structure of the code
62+
* :fire: `:fire:` when removing code or files
63+
* :racehorse: `:racehorse:` when improving performance
64+
* :white_check_mark: `:white_check_mark:` when adding tests
65+
* :green_heart: `:green_heart:` when fixing the CI build
66+
* :lock: `:lock:` when dealing with security
67+
* :crystal_ball: `:crystal_ball:` when experimenting
68+
* :unamused: `:unamused:` when doing chore work (updating dependencies, etc…)
69+
* :boom: `:boom:` when changing in a non-backwards-compatible way current functionality
70+
* :shipit: `:shipit:` when creating a new release
71+
72+
## Additional Resources
73+
+ [General GitHub documentation](https://help.github.com/)
74+
+ [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
75+
76+
[dw]: https://developer.ibm.com/answers/questions/ask/?topics=watson
77+
[stackoverflow]: http://stackoverflow.com/questions/ask?tags=ibm-watson
78+
[Maven]: https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
79+
[Gradle]: https://docs.gradle.org/current/userguide/installation.html

.github/issue_template.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Remember, an issue is not the place to ask questions. You can use [Stack Overflow](http://stackoverflow.com/questions/tagged/ibm-watson) for that, or you may want to start a discussion on the [dW Answers](https://developer.ibm.com/answers/questions/ask/?topics=watson).
2+
3+
Before you open an issue, please check if a similar issue already exists or has been closed before.
4+
5+
### When reporting a bug, please be sure to include the following:
6+
7+
- [ ] Start the title with the service name in brackets: `[speech-to-text] websockets...`
8+
- [ ] Steps to reproduce
9+
- [ ] Expected behavior
10+
- [ ] Actual behavior
11+
- [ ] JDK version
12+
- [ ] java-sdk version
13+
14+
15+
### When you open an issue for a feature request, please add as much detail as possible:
16+
- [ ] A descriptive title starting with the service name
17+
- [ ] A description of the problem you're trying to solve
18+
- [ ] A suggested solution if possible

.github/pull_request_template.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
### Summary
2+
3+
Provide a general description of the code changes in your pull
4+
request... were there any bugs you had fixed? If so, mention them. If
5+
these bugs have open GitHub issues, be sure to tag them here as well,
6+
to keep the conversation linked together.
7+
8+
### Other Information
9+
10+
If there's anything else that's important and relevant to your pull
11+
request, mention that information here.
12+
13+
14+
Thanks for contributing to the Watson Developer Cloud!

.gitignore

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,20 @@ gradle-app.setting
1010
# Cache of project
1111
.gradletasknamecache
1212

13-
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
14-
# gradle/wrapper/gradle-wrapper.properties
13+
.checkstyle
14+
.classpath
15+
.codepro
16+
.config.properties
17+
.DS_Store
18+
.idea
19+
.project
20+
.settings
21+
.vscode/
22+
docs
23+
out
24+
target
25+
26+
*.iml
27+
*.ipr
28+
*.iws
29+

README.md

Lines changed: 85 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,85 @@
1-
# watson-spring
2-
Spring Boot support for Watson services
1+
# Watson Spring Boot
2+
3+
[![Build Status](https://travis-ci.org/watson-developer-cloud/watson-spring.svg?branch=master)](https://travis-ci.org/watson-developer-cloud/watson-spring)
4+
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.ibm.watson.developer_cloud/watson-spring/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.ibm.watson.developer_cloud/watson-spring)
5+
[![CLA assistant](https://cla-assistant.io/readme/badge/watson-developer-cloud/watson-spring)](https://cla-assistant.io/watson-developer-cloud/watson-spring)
6+
7+
This project adds Spring Boot support for the Watson services.
8+
9+
This means that you can now "auto-wire" any of the Watson services into your Spring Boot application
10+
using the standard Spring autoconfiguration framework.
11+
12+
## Usage
13+
14+
All you need to do is:
15+
16+
1. Add the Watson spring-boot-starter dependency to your Spring Boot app:
17+
18+
In your maven `pom.xml`
19+
```
20+
<dependency>
21+
<groupId>com.ibm.watson.developer_cloud</groupId>
22+
<artifactId>spring-boot-starter</artifactId>
23+
<version>4.2.1</version>
24+
</dependency>
25+
```
26+
27+
or in your gradle `build.gradle`, in the dependencies stanza, add
28+
```
29+
compile 'com.ibm.watson.developer_cloud:spring-boot-starter:4.2.1'
30+
```
31+
32+
2. Add your Watson service(s) credentials and version info to your application
33+
properties file. The standard location for application properties is the
34+
`src/main/resources/application.properties` file, but your application might
35+
use a different location. The properties to add are:
36+
37+
- `watson.<service>.url`: The base URL for the service. This can be omitted if your
38+
service uses the default service url
39+
- `watson.<service>.username` and `watson.<service>.password` OR `watson.<service>.apiKey`:
40+
The credentials for accessing the service.
41+
The credentials can be omitted from the application properties file if they are
42+
supplied through the `VCAP_SERVICES` environment variable.
43+
- `watson.<service>.versionDate`: Some Watson services use a `versionDate` parameter to
44+
indicate the service behavior expected by the application. For services that accept it,
45+
this is a required parameter and must be specified in the application properties.
46+
47+
Both Eclipse and IntelliJ (Ultimate Edition) offer autocomplete support for
48+
Spring Boot application properties and should show these properties, along with
49+
their required type and Javadoc description, in the autocomplete menu.
50+
51+
3. Autowire the service into your application. Autowiring is the key mechanism of the
52+
Spring framework for injecting dependencies. It is accomplished by specifying the
53+
`@Autowired` annotation on the declaration for the service instance.
54+
Here's an example using the Watson Conversation service:
55+
```java
56+
@Autowired
57+
protected Conversation service;
58+
```
59+
60+
The Spring framework takes care of the rest. Your application can now simply start
61+
using the service instance.
62+
63+
## Open Source @ IBM
64+
65+
Find more open source projects on the [IBM Github Page](http://ibm.github.io/)
66+
67+
## License
68+
69+
This library is licensed under Apache 2.0. Full license text is
70+
available in [LICENSE](LICENSE).
71+
72+
## Contributing
73+
74+
See [CONTRIBUTING.md](.github/CONTRIBUTING.md).
75+
76+
## Code of Conduct
77+
78+
See [CODE_OF_CONDUCT.md](.github/CODE_OF_CONDUCT.md).
79+
80+
### Other
81+
82+
If you are having difficulties using the APIs or you have a question about the IBM
83+
Watson Services, please ask a question on
84+
[dW Answers](https://developer.ibm.com/answers/questions/ask/?topics=watson)
85+
or [Stack Overflow](http://stackoverflow.com/questions/ask?tags=ibm-watson).

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4.2.1

0 commit comments

Comments
 (0)