java - IntelliJ Spring Gradle Project Annotations Not Working -


so i'm trying start new web project in intellij using spring option in project configuration setups, when project setup, seems though new controllers make ignored though annotate them. @requestmapping seems never mapped. have ever been able access files located in root of web directory.

after never being able work switched gradle import additional libraries test project. gradle file looks following:

 buildscript {     repositories {         mavencentral()     }     dependencies {         classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.2.release")     } }  apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'idea' apply plugin: 'spring-boot'  sourcesets {     main {         java {             srcdirs = ['src/main/java']         }     }     test {         java {             srcdirs = ['src/main/test']         }     } }  jar {     basename = 'gs-rest-service'     version =  '0.1.0' }  repositories {     mavencentral() }  sourcecompatibility = 1.7 targetcompatibility = 1.7  dependencies {     compile("org.springframework.boot:spring-boot-starter-web")     testcompile("junit:junit")     testcompile "org.mockito:mockito-core:1.+" }  task wrapper(type: wrapper) {     gradleversion = '2.3' } 

is there sort of config file have fill out tell project controllers or pixie dust not working expect to?

here's controller looks like:

 @restcontroller public class greetingcontroller {     public static final string greeting = "hello, %s!";     private final atomiclong counter = new atomiclong();      @requestmapping("/greeting")     public greeting greeting(@requestparam(value="name", defaultvalue = "world") string name){         return new greeting(counter.incrementandget(), string.format(greeting, name));     } } 

and class annotated @springbootapplication:

 @springbootapplication public class application {     public static void main(string[] args) {         springapplication.run(application.class, args);     } } 

and folder structure:

 test - .gradle - .idea - build - gradle - out - src   - main     - java       - controllers         - application.java         - greetingcontroller.java     - test - web   - web-inf     - (empty) 

i'm confused how spring works @ point because annotations haven't come play yet. missing config file? spring starter tutorial says don't need one, maybe it's because i'm using intellij.

one last thing note i'm running using local tomcat instance.

thanks all!

if deploy application in tomcat, have create class extends springbootservletinitializer boot spring container. application class main method called when run jar/war java -jar yourfile.jar embedded tomcat (which included default spring boot starter web).

see documentation: http://docs.spring.io/spring-boot/docs/1.2.3.release/reference/htmlsingle/#howto-create-a-deployable-war-file


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -