DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report
  1. DZone
  2. Data Engineering
  3. Databases
  4. Spring Data Improvements in IntelliJ IDEA 2017.1

Spring Data Improvements in IntelliJ IDEA 2017.1

The soon to be released IntelliJ IDEA 2017.1 IDE includes some great improvements for working with Spring, Spring Data, and Spring Data NoSQL.

Trisha Gee user avatar by
Trisha Gee
·
Mar. 30, 17 · News
Like (4)
Save
Tweet
Share
6.49K Views

Join the DZone community and get the full member experience.

Join For Free

The upcoming IntelliJ IDEA 2017.1 includes numerous features to help Spring developers. In this post, we’re going to look specifically at the feature for Spring Data. Support for Spring Data has been updated to include support for features in release train Kay.

Navigation for New Repository Types

We’ve added a gutter icon for navigation to declarations of specific repository types

Reactive repository

In this example, you can see that we’ve annotated our configuration with @EnableReactiveCassandraRepositories.  If you click on the gutter icon next to the annotation, you can see the specific Reactive implementations of the repositories.

Navigate to reactive repo

You can, of course, click on one to be taken to its declaration. This also applies to repository fields that are autowired.

Autowired reactive repository

This navigation is available for: Cassandra, Couchbase, Elasticsearch, key-value repositories, Reactive Cassandra, Reactive MongoDB, Redis, and Solr.

Smarter Code Completion

IntelliJ IDEA 2017.1 is now even smarter at offering you Spring-specific help.  For example, you get support for creating query methods using nested properties. Let’s assume that you have a ReviewRepository, that enables you to find Reviews for a Hotel.

Review Repository

You may want to alter this to provide more complex searches, for example, to search for a Review by the hotel’s zip code (this is the nested parameter) and the rating of the review.

Find by nested parameter

You can see that IntelliJ IDEA offers you suggestions as you create this method, and can also generate the parameters for you.

IntelliJ IDEA 2017.1 also provides help for creating custom queries, code completion here helps to minimize errors.

Help with Query

As you’d expect, IntelliJ IDEA can also help with SQL queries you may need to write.  If need to use a native query IntelliJ IDEA will help you to craft this too. Remember you need to select a SQL dialect to get full help here.

Help with Native Query

Other annotations also have had the same treatment, so you have code completion, navigation and warnings about errors on the @Value annotation if you’re using Spring Data REST projections.

Help with Value

New Inspections

IntelliJ IDEA 2017.1 has updated inspections help to identify potential problems with query methods in repositories.  For example, you will now be informed if a method name refers to fields that don’t exist on the entity, as in this case where the method refers to “surname” but the Customer has a field “lastname”.

Unknown field

It doesn’t stop there.  Inspections will also let you know if the parameters to the method aren’t correct, as in this case here where we forgot to add firstname and lastname parameters

16IncorrectParameters

IntelliJ IDEA offers a quick fix for this problem of course

Quick fix for parameters

The inspection doesn’t just warn about missing parameters, but also incorrect parameter types

Incorrect parameter types

To provide full error checking, there’s a final inspection that ensures that the return type from the method is also correct

Incorrect return types

New Spring Data View

There’s a new view which shows you the Spring Data repositories

Spring data view

You can use this to see all your repositories and their query methods, along with the documentation for these methods. Of course, if you select one of the members, you will be taken to the code for that method.

Members and documentation

You can choose to show the inherited members too, in order to see all the available methods.

Show inherited members

As with all IntelliJ IDEA windows, it’s possible to easily search for the item you want by simply typing in the window.

Type to search

You can also choose to simply list all the repositories without grouping them by module

All repositories

And you can optionally display the repositories available from your project’s libraries

Include libraries

Spring Data LDAP Support

Finally, we’ve added support for the Spring Data LDAP project. This includes navigation and code completion in the XML configuration files, gutter icons for navigation, and support for @EnableLdapRepositories.

To give these new features a try, download IntelliJ IDEA 2017.1 Ultimate (now available as RC). Your feedback is very welcome here in the comments as well as in our issue tracker.

intellij Spring Data Spring Framework Data (computing) Database Repository (version control)

Published at DZone with permission of Trisha Gee, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • What Is QA as a Service?
  • How We Solved an OOM Issue in TiDB with GOMEMLIMIT
  • Key Elements of Site Reliability Engineering (SRE)
  • Utilizing Database Hooks Like a Pro in Node.js

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: