Showing posts with label IntelliJ. Show all posts
Showing posts with label IntelliJ. Show all posts

Tuesday, April 21, 2015

IntelliJ IDEA, Spring Data Plugin, and recognizing @EnableJpaRepositories Annotation

Today I worked through an IntelliJ IDEA 14.1.1 (THE latest and greatest as of today, 4/21/2015) configuration issue that had me baffled.

I could not get IntelliJ to recognize Spring Data Repositories. 

I am using Spring JavaConfig for a Spring MVC Web Application and have the following code-based config class:


/**
 * Spring JavaConfig Web Application Configuration for Spring MVC App.
 *
 * @author Philip Tenn
 */
@Configuration
@EnableWebMvc
@EnableTransactionManagement
@ComponentScan("com.philiptenn.scholarship")
@PropertySource("classpath:application.properties")
@EnableJpaRepositories(basePackages = "com.philiptenn.scholarship.repository")
public class WebAppConfig extends WebMvcConfigurationSupport {
...
}


My issue was that the @EnableJpaRepositories annotation was not causing the IDE to recognize Spring Data JPA Repositories in my basePackage to be recognized as Spring-managed Repositories.

I have this working in other environments and could not figure out why.

I worked through the following JetBrains guide: Enabling JPA Support.  However, this did not enable IntelliJ to recognize the annotation.

Since I had this exact same project working in a different install of IntelliJ in a VM, I figured that it had nothing to do with my project and had to be something global.

Taking an educated guess, went to plugins.  Found a plugin that was disabled that looked like it could be relevant ... :-)





























After enabling the Spring Data Plugin and restarting IntelliJ ... here was my result (SO HAPPY)!



Tuesday, April 14, 2015

IntelliJ IDEA and Git

Well, I've gotten a basic "Hello, world" Spring Web MVC Application running in JBoss Wildfly 8.2.0.Final set up with the initial Git Repo from OpenShift.

Now, I'm trying to do my first commit.  I've worked with Git through the Git Bash (msysgit), along with TortoiseGit and through Visual Studio / Git integration.

Even cloned, pushed, fetched to/from GitHub through these tools for .NET Projects.

However, this is my first experience using Git through IntelliJ IDEA on a pure Java project.

Initial take: for some reason IntelliJ is *not* picking up my user.name and user.email from the Global Git configuration.

From my Git Bash:

$ git config --list
core.symlinks=false
core.autocrlf=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
pack.packsizelimit=2g
help.format=html
http.sslcainfo=/bin/curl-ca-bundle.crt
sendemail.smtpserver=/bin/msmtp.exe
diff.astextplain.textconv=astextplain
rebase.autosquash=true
user.name=Philip Tenn
user.email=ptenn@users.noreply.github.com

What I am seeing on the VCS commit window in IntelliJ:


































I could (and did) manually type into this ComboBox my name and .  Just seemed strange it did not pick up from my Git config.