Giter Club home page Giter Club logo

intellij-spring-assistant's Introduction

Spring Assistant - IntelliJ plugin that assists you in developing spring applications

Plugin in action

What does the plugin do

This plugins provides the following features as of now.

  1. Auto completion of the configuration properties in your yaml files based on the spring boot's auto configuration jars are present in the classpath
  2. Auto completion of the configuration properties in your yaml files if you have classes annotated with @ConfigurationProperties, if your build is properly configured
  3. Short form search & search for element deep within is also supported. i.e, sp.d will show you spring.data, spring.datasource, also, port would show server.port as a suggestion
  4. Quick documentation for groups & properties (not all groups & properties will have documentation, depends on whether the original author specified documentation or not for any given element)
  5. Allows you to bootstrap new project & new module using File -> New -> Project -> Spring Assistant & File -> New -> Module -> Spring Assistant wizards. Looks & Feel resembles Intellij Ultimate, but with less bells & whistles

Usage

Assuming that you have Spring boot's auto configuration jars are present in the classpath, this plugin will automatically allows you to autocomplete properties as suggestions in all your yml files

Suggestions would appear as soon as you type/press CTRL+SPACE.

Short form suggestions are also supported such as, sp.d will show you spring.data, spring.datasource, e.t.c as suggestions that make your typing faster

In addition to libraries in the classpath, the plugin also allows you to have your own @ConfigurationProperties available as suggestions in all your yml files.

For this to work, you need to ensure the following steps are followed for your project/module

Setup for showing ConfigurationProperties as suggestions within current module

  1. Make sure Enable annotation processing is checked under Settings > Build, Execution & Deployment > Compiler > Annotation Processors

  2. Make sure you add the following changes to to your project

    For Maven

    Add the following dependency

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-configuration-processor</artifactId>
        <optional>true</optional>
    </dependency>

    For Gradle

    Add the following build configuration. You can use the propdeps-plugin for optional scope (as we dont need spring-boot-configuration-processor as a dependency in the generated jar/war)

    dependencies {
        optional "org.springframework.boot:spring-boot-configuration-processor"
    }
    
    compileJava.dependsOn(processResources)
  3. (OPTIONAL) If intellij is generating build artfacts to output directory instead of gradle's default build directory, then you may need to File | Settings | Build, Execution, Deployment | Build Tools | Gradle | Runner => Delegate IDE build/run actions to gradle & restart the IDE. This will ensure that gradle plugin generates metadata & Intellij is pointing to it

If you want to look at a sample project, look inside samples directory where the above setup is done. These samples allow properties from @ConfigurationProperties to be shown as suggestions

IMPORTANT

After changing your custom @ConfigurationProperties files, suggestions would be refreshed only after you trigger the build explicitly using keyboard (Ctrl+F9)/UI

Known behaviour in ambiguous cases

  1. If two groups from different auto configurations conflict with each other, the documentation for the group picked is random & undefined
  2. If a group & property represent the depth, the behaviour of the plugin is undefined.

Installation (in 3 easy steps)

To install the plugin open your editor (IntelliJ) and hit:

  1. File > Settings > Plugins and click on the Browse repositories button.
  2. Look for Spring Assistant the right click and select Download plugin.
  3. Finally hit the Apply button, agree to restart your IDE and you're all done!

Feel free to let me know what else you want added via the issues

Changelog

See here

License

Spring Assistant - IntelliJ Plugin is open-sourced software licensed under the MIT license

intellij-spring-assistant's People

Contributors

beichenhpy avatar cheng6563 avatar duttonw avatar eltonsandre avatar thekalinga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

intellij-spring-assistant's Issues

idea 2202.2 添加插件后启动报错

java.lang.IllegalStateException: Attempt to modify PSI for non-committed Document!
at com.intellij.pom.core.impl.PomModelImpl.startTransaction(PomModelImpl.java:266)
at com.intellij.pom.core.impl.PomModelImpl.lambda$runTransaction$2(PomModelImpl.java:96)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeNonCancelableSection$3(CoreProgressManager.java:223)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeInNonCancelableSection(CoreProgressManager.java:238)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:222)
at com.intellij.pom.core.impl.PomModelImpl.runTransaction(PomModelImpl.java:93)
at com.intellij.psi.impl.source.tree.ChangeUtil.prepareAndRunChangeAction(ChangeUtil.java:142)
at com.intellij.psi.impl.source.tree.CompositeElement.replaceChild(CompositeElement.java:625)
at com.intellij.psi.impl.source.codeStyle.CodeEditUtil.markWhitespaceForReformat(CodeEditUtil.java:271)
at com.intellij.psi.impl.source.codeStyle.CodeEditUtil.makePlaceHolderBetweenTokens(CodeEditUtil.java:256)
at com.intellij.psi.impl.source.codeStyle.CodeEditUtil.addChildren(CodeEditUtil.java:63)
at com.intellij.psi.impl.source.tree.CompositeElement.addInternal(CompositeElement.java:447)
at com.intellij.psi.impl.source.xml.XmlTagImpl.addInternalSuper(XmlTagImpl.java:336)
at com.intellij.psi.impl.source.xml.XmlTagImpl$XmlTagImplDelegate.addInternalSuper(XmlTagImpl.java:378)
at com.intellij.psi.impl.source.xml.XmlTagDelegate.genericInsert(XmlTagDelegate.java:1083)
at com.intellij.psi.impl.source.xml.XmlTagDelegate.addInternal(XmlTagDelegate.java:984)
at com.intellij.psi.impl.source.xml.XmlTagImpl.addInternal(XmlTagImpl.java:311)
at com.intellij.psi.impl.source.tree.CompositePsiElement.addAfter(CompositePsiElement.java:146)
at com.intellij.psi.impl.source.xml.XmlTagDelegate.addSubTag(XmlTagDelegate.java:917)
at com.intellij.psi.impl.source.xml.XmlTagImpl.addSubTag(XmlTagImpl.java:268)
at in.oneton.idea.spring.assistant.plugin.suggestion.component.ProjectOpenCloseListener.lambda$putAnnotationsConfig$7(ProjectOpenCloseListener.java:174)
at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.lambda$compute$3(WriteCommandAction.java:167)
at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.lambda$doRunWriteCommandAction$1(WriteCommandAction.java:150)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1023)
at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.lambda$doRunWriteCommandAction$2(WriteCommandAction.java:148)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:219)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:184)
at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.doRunWriteCommandAction(WriteCommandAction.java:157)
at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.run(WriteCommandAction.java:124)
at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.compute(WriteCommandAction.java:167)
at in.oneton.idea.spring.assistant.plugin.suggestion.component.ProjectOpenCloseListener.putAnnotationsConfig(ProjectOpenCloseListener.java:100)
at in.oneton.idea.spring.assistant.plugin.suggestion.component.ProjectOpenCloseListener.projectOpened(ProjectOpenCloseListener.java:81)
at com.intellij.util.messages.impl.MessageBusImplKt.invokeMethod(MessageBusImpl.kt:649)
at com.intellij.util.messages.impl.MessageBusImplKt.invokeListener(MessageBusImpl.kt:629)
at com.intellij.util.messages.impl.MessageBusImplKt.executeOrAddToQueue(MessageBusImpl.kt:470)
at com.intellij.util.messages.impl.ToDirectChildrenMessagePublisher.publish$intellij_platform_core(CompositeMessageBus.kt:259)
at com.intellij.util.messages.impl.MessagePublisher.invoke(MessageBusImpl.kt:425)
at jdk.proxy2/jdk.proxy2.$Proxy97.projectOpened(Unknown Source)
at com.intellij.openapi.project.impl.ProjectManagerExImplKt$openProject$$inlined$useWithScope$lambda$1$2.run(ProjectManagerExImpl.kt:633)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:608)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:607)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
at com.intellij.openapi.project.impl.ProjectManagerExImplKt$openProject$$inlined$useWithScope$lambda$1.run(ProjectManagerExImpl.kt:464)
at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:209)
at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:21)
at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:191)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:881)
at com.intellij.openapi.application.impl.ApplicationImpl$3.run(ApplicationImpl.java:513)
at com.intellij.openapi.application.impl.LaterInvocator$1.run(LaterInvocator.java:95)
at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:75)
at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:118)
at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:42)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:779)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:730)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:724)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:749)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:898)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:746)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:439)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:791)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:438)
at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:113)
at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:604)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:436)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:881)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:484)
at com.intellij.ide.IdeEventQueue.pumpEventsForHierarchy(IdeEventQueue.java:945)
at com.intellij.openapi.progress.util.ProgressWindow.lambda$startBlocking$4(ProgressWindow.java:211)
at com.intellij.openapi.application.impl.ApplicationImpl.runUnlockingIntendedWrite(ApplicationImpl.java:907)
at com.intellij.openapi.progress.util.ProgressWindow.startBlocking(ProgressWindow.java:206)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$execFromEDT$6(ProgressRunner.java:329)
at java.base/java.util.concurrent.CompletableFuture.uniAcceptNow(CompletableFuture.java:757)
at java.base/java.util.concurrent.CompletableFuture.uniAcceptStage(CompletableFuture.java:735)
at java.base/java.util.concurrent.CompletableFuture.thenAccept(CompletableFuture.java:2182)
at com.intellij.openapi.progress.impl.ProgressRunner.execFromEDT(ProgressRunner.java:326)
at com.intellij.openapi.progress.impl.ProgressRunner.submit(ProgressRunner.java:267)
at com.intellij.openapi.progress.impl.ProgressRunner.submitAndGet(ProgressRunner.java:193)
at com.intellij.openapi.project.impl.ProjectUiFrameAllocator.run(ProjectFrameAllocator.kt:117)
at com.intellij.openapi.project.impl.ProjectManagerExImpl.doOpenAsync(ProjectManagerExImpl.kt:127)
at com.intellij.openapi.project.impl.ProjectManagerExImpl.openProjectAsync(ProjectManagerExImpl.kt:114)
at com.intellij.ide.RecentProjectsManagerBase.openProject(RecentProjectsManagerBase.kt:332)
at com.intellij.openapi.wm.impl.welcomeScreen.recentProjects.RecentProjectItem.openProject(RecentProjectTreeItem.kt:84)
at com.intellij.openapi.wm.impl.welcomeScreen.recentProjects.RecentProjectFilteringTree$Companion.activateItem(RecentProjectFilteringTree.kt:654)
at com.intellij.openapi.wm.impl.welcomeScreen.recentProjects.RecentProjectFilteringTree$Companion.access$activateItem(RecentProjectFilteringTree.kt:633)
at com.intellij.openapi.wm.impl.welcomeScreen.recentProjects.RecentProjectFilteringTree$ProjectActionMouseListener.mousePressed(RecentProjectFilteringTree.kt:255)
at java.desktop/java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:288)
at java.desktop/java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:287)
at java.desktop/java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:287)
at java.desktop/java.awt.Component.processMouseEvent(Component.java:6645)
at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3392)
at com.intellij.ui.treeStructure.Tree.processMouseEvent(Tree.java:422)
at java.desktop/java.awt.Component.processEvent(Component.java:6413)
at java.desktop/java.awt.Container.processEvent(Container.java:2266)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5022)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4572)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2802)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:781)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:730)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:724)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:754)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:752)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:751)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:898)
at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:820)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:743)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:439)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:791)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:438)
at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:113)
at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:604)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:436)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:881)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:484)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.