More SerializerFactory clean up, getting read of BeanProperty arg
diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/BasicSerializerFactory.java b/src/main/java/com/fasterxml/jackson/databind/ser/BasicSerializerFactory.java
index 16e3eb6..cd9844d 100644
--- a/src/main/java/com/fasterxml/jackson/databind/ser/BasicSerializerFactory.java
+++ b/src/main/java/com/fasterxml/jackson/databind/ser/BasicSerializerFactory.java
@@ -458,7 +458,7 @@
      */
     @Deprecated
     protected final JsonSerializer<?> buildContainerSerializer(SerializerProvider prov,
-            JavaType type, BeanDescription beanDesc, BeanProperty Xproperty, boolean staticTyping)
+            JavaType type, BeanDescription beanDesc, BeanProperty property, boolean staticTyping)
         throws JsonMappingException
     {
         return  buildContainerSerializer(prov, type, beanDesc, staticTyping);
@@ -712,7 +712,7 @@
         }
         TypeSerializer vts = createTypeSerializer(config, valueType);
         return StdContainerSerializers.iteratorSerializer(valueType,
-                usesStaticTyping(config, beanDesc, vts, null), vts);
+                usesStaticTyping(config, beanDesc, vts), vts);
     }
     
     protected JsonSerializer<?> buildIterableSerializer(SerializationConfig config,
@@ -727,8 +727,7 @@
         }
         TypeSerializer vts = createTypeSerializer(config, valueType);
         return StdContainerSerializers.iterableSerializer(valueType,
-                usesStaticTyping(config, beanDesc, vts, null),
-                vts);
+                usesStaticTyping(config, beanDesc, vts), vts);
     }
     
     /*
@@ -822,15 +821,27 @@
         }
         return null;
     }
+
+    /**
+     * @deprecated Since 2.1: use method without 'property'
+     */
+    @Deprecated
+    protected final  boolean usesStaticTyping(SerializationConfig config,
+            BeanDescription beanDesc, TypeSerializer typeSer, BeanProperty property)
+    {
+        return usesStaticTyping(config, beanDesc, typeSer);
+    }
     
     /**
      * Helper method to check whether global settings and/or class
      * annotations for the bean class indicate that static typing
      * (declared types)  should be used for properties.
      * (instead of dynamic runtime types).
+     * 
+     * @since 2.1 (earlier had variant with additional 'property' parameter)
      */
     protected boolean usesStaticTyping(SerializationConfig config,
-            BeanDescription beanDesc, TypeSerializer typeSer, BeanProperty property)
+            BeanDescription beanDesc, TypeSerializer typeSer)
     {
         /* 16-Aug-2010, tatu: If there is a (value) type serializer, we can not force
          *    static typing; that would make it impossible to handle expected subtypes
@@ -849,22 +860,6 @@
                 return true;
             }
         }
-        /* 11-Mar-2011, tatu: Ok. This is bit hacky, but we really need to be able to find cases
-         *    where key and/or value serializers were specified, to force use of static typing
-         */
-        if (property != null) {
-            JavaType type = property.getType();
-            if (type.isContainerType()) {
-                if (intr.findSerializationContentType(property.getMember(), property.getType()) != null) {
-                    return true;
-                }
-                if (type instanceof MapType) {
-                    if (intr.findSerializationKeyType(property.getMember(), property.getType()) != null) {
-                        return true;
-                    }
-                }
-            }
-        }
         return false;
     }
 
diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/BeanSerializerFactory.java b/src/main/java/com/fasterxml/jackson/databind/ser/BeanSerializerFactory.java
index 4b42f7f..0ee5d03 100644
--- a/src/main/java/com/fasterxml/jackson/databind/ser/BeanSerializerFactory.java
+++ b/src/main/java/com/fasterxml/jackson/databind/ser/BeanSerializerFactory.java
@@ -154,7 +154,7 @@
         // (note: called method checks for module-provided serializers)
         if (origType.isContainerType()) {
             if (!staticTyping) {
-                staticTyping = usesStaticTyping(config, beanDesc, null, property);
+                staticTyping = usesStaticTyping(config, beanDesc, null);
                 // [JACKSON-822]: Need to figure out how to force passed parameterization
                 //  to stick...
                 /*
@@ -541,7 +541,7 @@
             return null;
         }
         // null is for value type serializer, which we don't have access to from here (ditto for bean prop)
-        boolean staticTyping = usesStaticTyping(config, beanDesc, null, null);
+        boolean staticTyping = usesStaticTyping(config, beanDesc, null);
         PropertyBuilder pb = constructPropertyBuilder(config, beanDesc);
         
         ArrayList<BeanPropertyWriter> result = new ArrayList<BeanPropertyWriter>(properties.size());
diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/ContainerSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/ContainerSerializer.java
index a28d96e..b08fb09 100644
--- a/src/main/java/com/fasterxml/jackson/databind/ser/ContainerSerializer.java
+++ b/src/main/java/com/fasterxml/jackson/databind/ser/ContainerSerializer.java
@@ -1,7 +1,10 @@
 package com.fasterxml.jackson.databind.ser;
 
+import com.fasterxml.jackson.databind.AnnotationIntrospector;
+import com.fasterxml.jackson.databind.BeanProperty;
 import com.fasterxml.jackson.databind.JavaType;
 import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.SerializerProvider;
 import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
 import com.fasterxml.jackson.databind.ser.std.StdSerializer;
 
@@ -106,4 +109,31 @@
      * addition type information is to be embedded.
      */
     protected abstract ContainerSerializer<?> _withValueTypeSerializer(TypeSerializer vts);
+
+    /*
+    /**********************************************************
+    /* Helper methods for sub-types
+    /**********************************************************
+     */
+
+    /**
+     * Helper method used to encapsulate logic for determining whether there is
+     * a property annotation that overrides element type; if so, we can
+     * and need to statically find the serializer.
+     * 
+     * @since 2.1
+     */
+    protected boolean hasContentTypeAnnotation(SerializerProvider provider,
+            BeanProperty property)
+    {
+        if (property != null) {
+            AnnotationIntrospector intr = provider.getAnnotationIntrospector();
+            if (intr != null) {
+                if (intr.findSerializationContentType(property.getMember(), property.getType()) != null) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
 }
diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/ArraySerializerBase.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/ArraySerializerBase.java
index 15073c3..1f68d91 100644
--- a/src/main/java/com/fasterxml/jackson/databind/ser/std/ArraySerializerBase.java
+++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/ArraySerializerBase.java
@@ -12,7 +12,7 @@
  * Intermediate base class for serializers used for various
  * Java arrays.
  * 
- * @param <T>
+ * @param <T> Type of arrays serializer handles
  */
 public abstract class ArraySerializerBase<T>
     extends ContainerSerializer<T>
diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/AsArraySerializerBase.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/AsArraySerializerBase.java
index d6febba..4f86926 100644
--- a/src/main/java/com/fasterxml/jackson/databind/ser/std/AsArraySerializerBase.java
+++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/AsArraySerializerBase.java
@@ -94,6 +94,12 @@
     /**********************************************************
      */
     
+    /**
+     * This method is needed to resolve contextual annotations like
+     * per-property overrides, as well as do recursive call
+     * to <code>createContextual</code> of content serializer, if
+     * known statically.
+     */
 //  @Override
     public JsonSerializer<?> createContextual(SerializerProvider provider,
             BeanProperty property)
@@ -122,8 +128,12 @@
             ser = _elementSerializer;
         }
         if (ser == null) {
-            if (_staticTyping && _elementType != null) {
-                ser = provider.findValueSerializer(_elementType, property);
+            // 30-Sep-2012, tatu: One more thing -- if explicit content type is annotated,
+            //   we can consider it a static case as well.
+            if (_elementType != null) {
+                if (_staticTyping || hasContentTypeAnnotation(provider, property)) {
+                    ser = provider.findValueSerializer(_elementType, property);
+                }
             }
         } else if (ser instanceof ContextualSerializer) {
             ser = ((ContextualSerializer) ser).createContextual(provider, property);
@@ -133,7 +143,7 @@
         }
         return this;
     }
-
+    
     /*
     /**********************************************************
     /* Accessors
diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/MapSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/MapSerializer.java
index b78eb3a..23a3146 100644
--- a/src/main/java/com/fasterxml/jackson/databind/ser/std/MapSerializer.java
+++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/MapSerializer.java
@@ -215,7 +215,9 @@
             ser = _valueSerializer;
         }
         if (ser == null) {
-            if (_valueTypeIsStatic) {
+            // 30-Sep-2012, tatu: One more thing -- if explicit content type is annotated,
+            //   we can consider it a static case as well.
+            if (_valueTypeIsStatic || hasContentTypeAnnotation(provider, property)) {
                 ser = provider.findValueSerializer(_valueType, property);
             }
         } else if (ser instanceof ContextualSerializer) {
diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/ObjectArraySerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/ObjectArraySerializer.java
index 9f281ab..17a5e98 100644
--- a/src/main/java/com/fasterxml/jackson/databind/ser/std/ObjectArraySerializer.java
+++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/ObjectArraySerializer.java
@@ -141,8 +141,12 @@
             ser = _elementSerializer;
         }
         if (ser == null) {
-            if (_staticTyping) {
-                ser = provider.findValueSerializer(_elementType, property);
+            // 30-Sep-2012, tatu: One more thing -- if explicit content type is annotated,
+            //   we can consider it a static case as well.
+            if (_elementType != null) {
+                if (_staticTyping || hasContentTypeAnnotation(provider, property)) {
+                    ser = provider.findValueSerializer(_elementType, property);
+                }
             }
         } else if (ser instanceof ContextualSerializer) {
             ser = ((ContextualSerializer) _elementSerializer).createContextual(provider, property);
diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/TestJsonSerialize2.java b/src/test/java/com/fasterxml/jackson/databind/ser/TestJsonSerialize2.java
index 24af2d3..6bd2d6e 100644
--- a/src/test/java/com/fasterxml/jackson/databind/ser/TestJsonSerialize2.java
+++ b/src/test/java/com/fasterxml/jackson/databind/ser/TestJsonSerialize2.java
@@ -146,6 +146,13 @@
         assertEquals("[\"value foo\"]", m.writeValueAsString(list));
     }
 
+    // [JACKSON-480], test annotations when applied to List property (getter, setter)
+    public void testSerializedAsListWithPropertyAnnotations() throws IOException
+    {
+        ListWrapperSimple input = new ListWrapperSimple("bar");
+        assertEquals("{\"values\":[{\"value\":\"bar\"}]}", MAPPER.writeValueAsString(input));
+    }
+    
     // [JACKSON-480], test Serialization annotation with Map
     public void testSerializedAsMapWithClassSerializer() throws IOException
     {
@@ -153,25 +160,19 @@
         map.put(new SimpleKey("abc"), new ActualValue("123"));
         assertEquals("{\"key abc\":\"value 123\"}", MAPPER.writeValueAsString(map));
     }
-    
-    // [JACKSON-480], test annotations when applied to List property (getter, setter)
-    public void testSerializedAsListWithPropertyAnnotations() throws IOException
-    {
-        ListWrapperSimple input = new ListWrapperSimple("bar");
-        assertEquals("{\"values\":[{\"value\":\"bar\"}]}", MAPPER.writeValueAsString(input));
-    }
 
-    public void testSerializedAsListWithPropertyAnnotations2() throws IOException
-    {
-        ListWrapperWithSerializer input = new ListWrapperWithSerializer("abc");
-        assertEquals("{\"values\":[\"value abc\"]}", MAPPER.writeValueAsString(input));
-    }
-    
     // [JACKSON-480], test annotations when applied to Map property (getter, setter)
     public void testSerializedAsMapWithPropertyAnnotations() throws IOException
     {
         MapWrapperSimple input = new MapWrapperSimple("a", "b");
-        assertEquals("{\"values\":{\"toString:a\":{\"value\":\"b\"}}}", MAPPER.writeValueAsString(input));
+        assertEquals("{\"values\":{\"toString:a\":{\"value\":\"b\"}}}",
+                MAPPER.writeValueAsString(input));
+    }
+    
+    public void testSerializedAsListWithPropertyAnnotations2() throws IOException
+    {
+        ListWrapperWithSerializer input = new ListWrapperWithSerializer("abc");
+        assertEquals("{\"values\":[\"value abc\"]}", MAPPER.writeValueAsString(input));
     }
 
     public void testSerializedAsMapWithPropertyAnnotations2() throws IOException