Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9146989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:52:45+00:00 2026-06-17T10:52:45+00:00

Reading the @RequestMapping documentation : http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/web/bind/annotation/RequestMapping.html It accepts a String array parameter for its

  • 0

Reading the @RequestMapping documentation : http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/web/bind/annotation/RequestMapping.html

It accepts a String array parameter for its path mapping.

So this works using java :

@RequestMapping("MYVIEW")

but in scala I need to use :

@RequestMapping(Array("MYVIEW"))

The scala version makes sense as the annotation expects a String array. But why does above work in java, should it not give a compile time error ?

Below class ‘ArrayChecker’ (a class I wrote to illustrate this point) causes a java compile time error :

The method acceptArrayParam(String[]) in the type ArrayChecker is not
applicable for the arguments (String)

public class ArrayChecker {

    public static void main(String args[]){

        String[] strArray;

        acceptArrayParam("test");
    }

    private static void acceptArrayParam(String[] param){

    }
}

Should a similar error not be caused by @RequestMapping(“MYVIEW”) ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T10:52:47+00:00Added an answer on June 17, 2026 at 10:52 am

    Section 9.7.1 of the Java SE specification states:

    If the element type is an array type and the corresponding ElementValue is not an ElementValueArrayInitializer, then an array value whose sole element is the value represented by the ElementValue is associated with the element. Otherwise, if the corresponding ElementValue is an ElementValueArrayInitializer, then the array value represented by the ElementValueArrayInitializer is associated with the element.

    With a comment clarifying the above stating:

    In other words, it is permissible to omit the curly braces when a single-element array is to be associated with an array-valued annotation type element.

    Because Scala has no equivalent array initializer syntax, you must use Array(elems).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Reading the documentation at http://jersey.java.net/nonav/documentation/latest/client-api.html#d4e704 makes me think that ClientFilter s are processed in
Reading manual about Sling http://sling.apache.org/site/46-line-blog.html added folder blog and blog.html to destination: \launchpad\content\src\main\resources\content\ but
Reading the section Zend_Application_Resource_Modules in the docs here: http://framework.zend.com/manual/1.10/en/zend.application.available-resources.html I noticed this: You can
Reading this: http://guides.rubyonrails.org/routing.html#adding-more-restful-actions What does it mean to add a 'member route'? or do
Reading this page http://flask.pocoo.org/docs/patterns/streaming/ it seems like I might be able to do what
reading the documentation for java org.w3c.dom.ls it seems as a Element only can be
Reading msdn documentation for dictionaries it says : Public static (Shared in Visual Basic)
I was reading the Spring 3.0 Documentation and Blog Posts (followups) on how to
Reading the documentation page of BugTracker.NET BugTracker.NET API Documentation I realized that I need
Reading the javadoc for EhCacheManagerFactoryBean and EhCacheFactoryBean I figured that: <bean id=cacheManager class=org.springframework.cache.ehcache.EhCacheManagerFactoryBean p:configLocation=classpath:ehcache.xml/>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.